| Line 67... |
Line 67... |
| 67 |
self.otherCost = otherCost
|
67 |
self.otherCost = otherCost
|
| 68 |
|
68 |
|
| 69 |
class __AmazonDetails:
|
69 |
class __AmazonDetails:
|
| 70 |
def __init__(self, sku, ourSp, ourRank, lowestSellerName,lowestSellerSp,secondLowestSellerName, secondLowestSellerSp, thirdLowestSellerName, thirdLowestSellerSp, totalSeller, multipleListings, \
|
70 |
def __init__(self, sku, ourSp, ourRank, lowestSellerName,lowestSellerSp,secondLowestSellerName, secondLowestSellerSp, thirdLowestSellerName, thirdLowestSellerSp, totalSeller, multipleListings, \
|
| 71 |
promoPrice, isPromotion, lowestSellerShippingTime, lowestSellerRating, secondLowestSellerShippingTime, secondLowestSellerRating, thirdLowestSellerShippingTime , \
|
71 |
promoPrice, isPromotion, lowestSellerShippingTime, lowestSellerRating, secondLowestSellerShippingTime, secondLowestSellerRating, thirdLowestSellerShippingTime , \
|
| 72 |
thirdLowestSellerRating, lowestSellerType, secondLowestSellerType, thirdLowestSellerType):
|
72 |
thirdLowestSellerRating, lowestSellerType, secondLowestSellerType, thirdLowestSellerType, lowestMfnIgnoredOffer, lowestMfnOffer, lowestFbaOffer, \
|
| - |
|
73 |
isLowestMfnIgnored, isLowestMfn, isLowestFba, competitivePrice):
|
| 73 |
self.sku =sku
|
74 |
self.sku =sku
|
| 74 |
self.ourSp = ourSp
|
75 |
self.ourSp = ourSp
|
| 75 |
self.ourRank = ourRank
|
76 |
self.ourRank = ourRank
|
| 76 |
self.lowestSellerName = lowestSellerName
|
77 |
self.lowestSellerName = lowestSellerName
|
| 77 |
self.lowestSellerSp = lowestSellerSp
|
78 |
self.lowestSellerSp = lowestSellerSp
|
| Line 90... |
Line 91... |
| 90 |
self.thirdLowestSellerShippingTime= thirdLowestSellerShippingTime
|
91 |
self.thirdLowestSellerShippingTime= thirdLowestSellerShippingTime
|
| 91 |
self.thirdLowestSellerRating = thirdLowestSellerRating
|
92 |
self.thirdLowestSellerRating = thirdLowestSellerRating
|
| 92 |
self.lowestSellerType = lowestSellerType
|
93 |
self.lowestSellerType = lowestSellerType
|
| 93 |
self.secondLowestSellerType = secondLowestSellerType
|
94 |
self.secondLowestSellerType = secondLowestSellerType
|
| 94 |
self.thirdLowestSellerType = thirdLowestSellerType
|
95 |
self.thirdLowestSellerType = thirdLowestSellerType
|
| - |
|
96 |
self.lowestMfnIgnoredOffer = lowestMfnIgnoredOffer
|
| - |
|
97 |
self.isLowestMfnIgnored = isLowestMfnIgnored
|
| - |
|
98 |
self.lowestMfnOffer = lowestMfnOffer
|
| - |
|
99 |
self.isLowestMfn = isLowestMfn
|
| - |
|
100 |
self.lowestFbaOffer = lowestFbaOffer
|
| - |
|
101 |
self.isLowestFba = isLowestFba
|
| - |
|
102 |
self.competitivePrice = competitivePrice
|
| 95 |
|
103 |
|
| 96 |
|
104 |
|
| 97 |
class __AmazonPricing:
|
105 |
class __AmazonPricing:
|
| 98 |
|
106 |
|
| 99 |
def __init__(self, ourSp, lowestPossibleSp):
|
107 |
def __init__(self, ourSp, lowestPossibleSp):
|
| Line 265... |
Line 273... |
| 265 |
def getLastDaySale(fbaSaleSnapshot):
|
273 |
def getLastDaySale(fbaSaleSnapshot):
|
| 266 |
if fbaSaleSnapshot.item_id==0:
|
274 |
if fbaSaleSnapshot.item_id==0:
|
| 267 |
return 0
|
275 |
return 0
|
| 268 |
else:
|
276 |
else:
|
| 269 |
return fbaSaleSnapshot.totalOrderCount
|
277 |
return fbaSaleSnapshot.totalOrderCount
|
| - |
|
278 |
|
| - |
|
279 |
def getNoOfDaysInStock(oosStatus):
|
| - |
|
280 |
inStockCount = 0
|
| - |
|
281 |
for obj in oosStatus:
|
| - |
|
282 |
if not obj.isOutOfStock:
|
| - |
|
283 |
inStockCount+=1
|
| - |
|
284 |
return inStockCount
|
| - |
|
285 |
|
| - |
|
286 |
def getCheapestMfnCount(timestamp,itemId):
|
| - |
|
287 |
query = session.query(func.count(AmazonScrapingHistory.cheapestMfnCount)).filter(AmazonScrapingHistory.item_id==itemId).filter(AmazonScrapingHistory.timestamp>=timestamp-timedelta(days=5))
|
| - |
|
288 |
cheapestCount = query.filter(AmazonScrapingHistory.cheapestMfnCount==True).scalar()
|
| - |
|
289 |
total = query.scalar()
|
| - |
|
290 |
if total==0:
|
| - |
|
291 |
return 0
|
| - |
|
292 |
return float(cheapestCount)/total
|
| - |
|
293 |
|
| - |
|
294 |
|
| 270 |
|
295 |
|
| 271 |
#def syncAsin():
|
296 |
#def syncAsin():
|
| 272 |
## notListedOnAmazon = []
|
297 |
## notListedOnAmazon = []
|
| 273 |
## diffAsins = []
|
298 |
## diffAsins = []
|
| 274 |
## login_url = "https://sellercentral.amazon.in/gp/homepage.html"
|
299 |
## login_url = "https://sellercentral.amazon.in/gp/homepage.html"
|
| Line 453... |
Line 478... |
| 453 |
item.isPromotion = ourPricing.get('promotion')
|
478 |
item.isPromotion = ourPricing.get('promotion')
|
| 454 |
item.asin = ourPricing.get('asin')
|
479 |
item.asin = ourPricing.get('asin')
|
| 455 |
|
480 |
|
| 456 |
|
481 |
|
| 457 |
|
482 |
|
| 458 |
def decideCategory(itemInfo):
|
483 |
def decideCategory(itemInfo,timestamp):
|
| 459 |
exceptionList, negativeMargin, cheapest, amongCheapestAndCanCompete, canCompete, almostCompete, cantCompete = [],[],[],[],[],[],[]
|
484 |
exceptionList, negativeMargin, cheapest, amongCheapestAndCanCompete, canCompete, almostCompete, cantCompete = [],[],[],[],[],[],[]
|
| 460 |
skus = []
|
485 |
skus = []
|
| 461 |
for item in itemInfo:
|
486 |
for item in itemInfo:
|
| 462 |
skus.append(item.sku)
|
487 |
skus.append(item.sku)
|
| 463 |
aggResponse = amScraper.get_competitive_pricing_for_sku('A21TJRUUN4KGV', skus)
|
488 |
pricingResponse = amScraper.get_competitive_pricing_for_sku('A21TJRUUN4KGV', skus)
|
| - |
|
489 |
aggResponse = pricingResponse[0]
|
| - |
|
490 |
otherInfo = pricingResponse[1]
|
| 464 |
ourPricingForSku = amScraper.get_my_pricing_for_sku('A21TJRUUN4KGV', skus)
|
491 |
ourPricingForSku = amScraper.get_my_pricing_for_sku('A21TJRUUN4KGV', skus)
|
| 465 |
|
492 |
|
| 466 |
for val in itemInfo:
|
493 |
for val in itemInfo:
|
| 467 |
scrapInfo = aggResponse.get(val.sku)
|
494 |
scrapInfo = aggResponse.get(val.sku)
|
| - |
|
495 |
competitvePricingInfo = otherInfo.get(val.sku)
|
| 468 |
if scrapInfo is None or len(scrapInfo)==0 or val.nlc==0 or len(ourPricingForSku.get(val.sku).keys())==0:
|
496 |
if scrapInfo is None or len(scrapInfo)==0 or val.nlc==0 or len(ourPricingForSku.get(val.sku).keys())==0:
|
| 469 |
temp = []
|
497 |
temp = []
|
| 470 |
temp.append(val)
|
498 |
temp.append(val)
|
| 471 |
if val.nlc==0 or val.nlc is None:
|
499 |
if val.nlc==0 or val.nlc is None:
|
| 472 |
print "WANLC is 0"
|
500 |
print "WANLC is 0"
|
| Line 529... |
Line 557... |
| 529 |
iterator += 1
|
557 |
iterator += 1
|
| 530 |
print "terminating iterator"
|
558 |
print "terminating iterator"
|
| 531 |
|
559 |
|
| 532 |
print "Creating object am details",val.sku
|
560 |
print "Creating object am details",val.sku
|
| 533 |
amDetails = __AmazonDetails(sku, float(ourSp), ourRank, lowestSellerName,float(lowestSellerSp),secondLowestSellerName, float(secondLowestSellerSp), thirdLowestSellerName, float(thirdLowestSellerSp),len(scrapInfo),multipleListings,promoPrice,isPromo, \
|
561 |
amDetails = __AmazonDetails(sku, float(ourSp), ourRank, lowestSellerName,float(lowestSellerSp),secondLowestSellerName, float(secondLowestSellerSp), thirdLowestSellerName, float(thirdLowestSellerSp),len(scrapInfo),multipleListings,promoPrice,isPromo, \
|
| 534 |
lowestSellerShippingTime ,lowestSellerRating, secondLowestSellerShippingTime, secondLowestSellerRating, thirdLowestSellerShippingTime , thirdLowestSellerRating, lowestSellerType, secondLowestSellerType, thirdLowestSellerType)
|
562 |
lowestSellerShippingTime ,lowestSellerRating, secondLowestSellerShippingTime, secondLowestSellerRating, thirdLowestSellerShippingTime , thirdLowestSellerRating, lowestSellerType, secondLowestSellerType, thirdLowestSellerType, \
|
| 535 |
print "am details obj created"
|
563 |
competitvePricingInfo['lowestMfnIgnored'],competitvePricingInfo['lowestMfn'],competitvePricingInfo['lowestFba'],competitvePricingInfo['isLowestMfnIgnored'],competitvePricingInfo['isLowestMfn'],competitvePricingInfo['isLowestFba'],None)
|
| - |
|
564 |
|
| - |
|
565 |
competitivePrice = decideCompetitvePricing(amDetails,val.ourInventory,timestamp)
|
| - |
|
566 |
amDetails.competitivePrice = competitivePrice
|
| - |
|
567 |
if amDetails.competitivePrice==0.0 and amDetails.ourRank > 1:
|
| - |
|
568 |
print "vat exception"
|
| - |
|
569 |
temp = []
|
| - |
|
570 |
temp.append(val)
|
| - |
|
571 |
temp.append("Unable to calculate competitive pricing")
|
| - |
|
572 |
exceptionList.append(temp)
|
| - |
|
573 |
continue
|
| 536 |
try:
|
574 |
try:
|
| 537 |
print "inside val getter"
|
575 |
print "inside val getter"
|
| 538 |
itemVatMaster = ItemVatMaster.query.filter(and_(ItemVatMaster.itemId==int(val.sku[3:]), ItemVatMaster.stateId==val.state_id)).first()
|
576 |
itemVatMaster = ItemVatMaster.query.filter(and_(ItemVatMaster.itemId==int(val.sku[3:]), ItemVatMaster.stateId==val.state_id)).first()
|
| 539 |
if itemVatMaster is None:
|
577 |
if itemVatMaster is None:
|
| 540 |
d_item = Item.query.filter_by(id=int(val.sku[3:])).first()
|
578 |
d_item = Item.query.filter_by(id=int(val.sku[3:])).first()
|
| Line 583... |
Line 621... |
| 583 |
temp.append(amPricing)
|
621 |
temp.append(amPricing)
|
| 584 |
cheapest.append(temp)
|
622 |
cheapest.append(temp)
|
| 585 |
print "val sku cat cheapest ",val.sku
|
623 |
print "val sku cat cheapest ",val.sku
|
| 586 |
continue
|
624 |
continue
|
| 587 |
|
625 |
|
| - |
|
626 |
if val.parent_category in [10006,10009,11001]:
|
| - |
|
627 |
if (amDetails.competitivePrice > amPricing.lowestPossibleSp) and ((((float(float(amDetails.promoPrice) - amDetails.competitivePrice))/float(amDetails.promoPrice))<=.0025) or ((float(amDetails.promoPrice) - amDetails.competitivePrice)<=25)):
|
| - |
|
628 |
temp = []
|
| - |
|
629 |
temp.append(val)
|
| - |
|
630 |
temp.append(amDetails)
|
| - |
|
631 |
temp.append(amPricing)
|
| - |
|
632 |
amongCheapestAndCanCompete.append(temp)
|
| - |
|
633 |
print "val sku cat amongCheapestAndCanCompete ",val.sku
|
| - |
|
634 |
continue
|
| - |
|
635 |
else:
|
| 588 |
if (amDetails.lowestSellerSp > amPricing.lowestPossibleSp) and ((((float(float(amDetails.promoPrice) - amDetails.lowestSellerSp))/float(amDetails.promoPrice))<=.01) or ((float(amDetails.promoPrice) - amDetails.lowestSellerSp)<=25)):
|
636 |
if (amDetails.competitivePrice > amPricing.lowestPossibleSp) and ((((float(float(amDetails.promoPrice) - amDetails.competitivePrice))/float(amDetails.promoPrice))<=.01) or ((float(amDetails.promoPrice) - amDetails.competitivePrice)<=10)):
|
| 589 |
temp = []
|
637 |
temp = []
|
| 590 |
temp.append(val)
|
638 |
temp.append(val)
|
| 591 |
temp.append(amDetails)
|
639 |
temp.append(amDetails)
|
| 592 |
temp.append(amPricing)
|
640 |
temp.append(amPricing)
|
| 593 |
amongCheapestAndCanCompete.append(temp)
|
641 |
amongCheapestAndCanCompete.append(temp)
|
| 594 |
print "val sku cat amongCheapestAndCanCompete ",val.sku
|
642 |
print "val sku cat amongCheapestAndCanCompete ",val.sku
|
| 595 |
continue
|
643 |
continue
|
| 596 |
|
644 |
|
| 597 |
if (amDetails.lowestSellerSp > amPricing.lowestPossibleSp):
|
645 |
if (amDetails.competitivePrice > amPricing.lowestPossibleSp):
|
| 598 |
temp = []
|
646 |
temp = []
|
| 599 |
temp.append(val)
|
647 |
temp.append(val)
|
| 600 |
temp.append(amDetails)
|
648 |
temp.append(amDetails)
|
| 601 |
temp.append(amPricing)
|
649 |
temp.append(amPricing)
|
| 602 |
canCompete.append(temp)
|
650 |
canCompete.append(temp)
|
| 603 |
print "val sku cat can compete ",val.sku
|
651 |
print "val sku cat can compete ",val.sku
|
| 604 |
continue
|
652 |
continue
|
| 605 |
|
653 |
|
| 606 |
if amDetails.lowestSellerSp*(1+.01) >= amPricing.lowestPossibleSp:
|
654 |
if amDetails.competitivePrice*(1+.01) >= amPricing.lowestPossibleSp:
|
| 607 |
temp = []
|
655 |
temp = []
|
| 608 |
temp.append(val)
|
656 |
temp.append(val)
|
| 609 |
temp.append(amDetails)
|
657 |
temp.append(amDetails)
|
| 610 |
temp.append(amPricing)
|
658 |
temp.append(amPricing)
|
| 611 |
almostCompete.append(temp)
|
659 |
almostCompete.append(temp)
|
| 612 |
print "val sku cat almost compete ",val.sku
|
660 |
print "val sku cat almost compete ",val.sku
|
| 613 |
continue
|
661 |
continue
|
| 614 |
|
- |
|
| 615 |
|
662 |
|
| 616 |
temp = []
|
663 |
temp = []
|
| 617 |
temp.append(val)
|
664 |
temp.append(val)
|
| 618 |
temp.append(amDetails)
|
665 |
temp.append(amDetails)
|
| 619 |
temp.append(amPricing)
|
666 |
temp.append(amPricing)
|
| Line 621... |
Line 668... |
| 621 |
cantCompete.append(temp)
|
668 |
cantCompete.append(temp)
|
| 622 |
print "Created category..."
|
669 |
print "Created category..."
|
| 623 |
|
670 |
|
| 624 |
return exceptionList, negativeMargin, cheapest, amongCheapestAndCanCompete, canCompete, almostCompete, cantCompete
|
671 |
return exceptionList, negativeMargin, cheapest, amongCheapestAndCanCompete, canCompete, almostCompete, cantCompete
|
| 625 |
|
672 |
|
| - |
|
673 |
|
| - |
|
674 |
def decideCompetitvePricing(amDetails,ourInventory,timestamp):
|
| - |
|
675 |
'''
|
| - |
|
676 |
lowestMfnIgnoredOffer, lowestMfnOffer, lowestFbaOffer, isLowestMfnIgnored, isLowestMfn, isLowestFba
|
| - |
|
677 |
'''
|
| - |
|
678 |
|
| - |
|
679 |
if amDetails.ourRank==1:
|
| - |
|
680 |
return 0.0
|
| - |
|
681 |
else:
|
| - |
|
682 |
if amDetails.isLowestMfn and amDetails.isLowestFba:
|
| - |
|
683 |
if amDetails.lowestMfnOffer >= amDetails.lowestFbaOffer:
|
| - |
|
684 |
return amDetails.lowestFbaOffer
|
| - |
|
685 |
else:
|
| - |
|
686 |
#TODO Check last five days history.
|
| - |
|
687 |
ratio = getCheapestMfnCount(timestamp,amDetails.sku[3:])
|
| - |
|
688 |
daysInStock = getNoOfDaysInStock(saleMap.get(amDetails.sku))
|
| - |
|
689 |
try:
|
| - |
|
690 |
daysOfStock = (float(ourInventory))/calculateAverageSale(amDetails.sku)
|
| - |
|
691 |
except:
|
| - |
|
692 |
daysOfStock = float("inf")
|
| - |
|
693 |
if daysInStock >= 4 and daysOfStock > 20 and ratio >=.8:
|
| - |
|
694 |
return amDetails.lowestMfnOffer
|
| - |
|
695 |
else:
|
| - |
|
696 |
return 0.0
|
| - |
|
697 |
elif amDetails.isLowestFba:
|
| - |
|
698 |
return amDetails.lowestFbaOffer
|
| - |
|
699 |
elif amDetails.isLowestMfn:
|
| - |
|
700 |
#TODO Check last five days history
|
| - |
|
701 |
ratio = getCheapestMfnCount(timestamp,amDetails.sku[3:])
|
| - |
|
702 |
daysInStock = getNoOfDaysInStock(saleMap.get(amDetails.sku))
|
| - |
|
703 |
try:
|
| - |
|
704 |
daysOfStock = (float(ourInventory))/calculateAverageSale(amDetails.sku)
|
| - |
|
705 |
except:
|
| - |
|
706 |
daysOfStock = float("inf")
|
| - |
|
707 |
if daysInStock >= 4 and daysOfStock > 20 and ratio >.8:
|
| - |
|
708 |
return amDetails.lowestMfnOffer
|
| - |
|
709 |
else:
|
| - |
|
710 |
return 0.0
|
| - |
|
711 |
else:
|
| - |
|
712 |
return 0.0
|
| - |
|
713 |
|
| 626 |
def getBreakevenPrice(item,val,spm):
|
714 |
def getBreakevenPrice(item,val,spm):
|
| 627 |
breakEvenPrice = (val.nlc+(val.courierCost)*(1+(spm.serviceTax/100))*(1+(val.vatRate/100))+(15.0+val.otherCost)*(1+(val.vatRate)/100))/(1-(spm.commission/100+spm.emiFee/100)*(1+(spm.serviceTax/100))*(1+(val.vatRate)/100)-(spm.returnProvision/100)*(1+(val.vatRate)/100));
|
715 |
breakEvenPrice = (val.nlc+(val.courierCost)*(1+(spm.serviceTax/100))*(1+(val.vatRate/100))+(15.0+val.otherCost)*(1+(val.vatRate)/100))/(1-(spm.commission/100+spm.emiFee/100)*(1+(spm.serviceTax/100))*(1+(val.vatRate)/100)-(spm.returnProvision/100)*(1+(val.vatRate)/100));
|
| 628 |
return round(breakEvenPrice,2)
|
716 |
return round(breakEvenPrice,2)
|
| 629 |
|
717 |
|
| 630 |
def getLowestPossibleSp(amazonDetails,val,spm):
|
718 |
def getLowestPossibleSp(amazonDetails,val,spm):
|
| 631 |
lowestPossibleSp = (val.nlc+(val.courierCost)*(1+(spm.serviceTax/100))*(1+(val.vatRate/100))+(15.0+val.otherCost)*(1+(val.vatRate)/100))/(1-(spm.commission/100+spm.emiFee/100)*(1+(spm.serviceTax/100))*(1+(val.vatRate)/100)-(spm.returnProvision/100)*(1+(val.vatRate)/100));
|
- |
|
| 632 |
if val.isPromo:
|
719 |
if val.isPromo:
|
| 633 |
if amazonLongTermActivePromotions.has_key(val.sku):
|
720 |
if amazonLongTermActivePromotions.has_key(val.sku):
|
| 634 |
subsidy = (amazonLongTermActivePromotions.get(val.sku)).subsidy
|
721 |
subsidy = (amazonLongTermActivePromotions.get(val.sku)).subsidy
|
| 635 |
else:
|
722 |
else:
|
| 636 |
subsidy = (amazonShortTermActivePromotions.get(val.sku)).subsidy
|
723 |
subsidy = (amazonShortTermActivePromotions.get(val.sku)).subsidy
|
| - |
|
724 |
else:
|
| 637 |
print "subsidy ",subsidy
|
725 |
subsidy = 0.0
|
| - |
|
726 |
|
| 638 |
lowestPossibleSp = (val.nlc-subsidy+(val.courierCost)*(1+(spm.serviceTax/100))*(1+(val.vatRate/100))+(15.0+val.otherCost)*(1+(val.vatRate)/100))/(1-(spm.commission/100+spm.emiFee/100)*(1+(spm.serviceTax/100))*(1+(val.vatRate)/100)-(spm.returnProvision/100)*(1+(val.vatRate)/100));
|
727 |
lowestPossibleSp = (val.nlc-subsidy+(val.courierCost)*(1+(spm.serviceTax/100))*(1+(val.vatRate/100))+(15.0+val.otherCost)*(1+(val.vatRate)/100))/(1-(spm.commission/100+spm.emiFee/100)*(1+(spm.serviceTax/100))*(1+(val.vatRate)/100)-(spm.returnProvision/100)*(1+(val.vatRate)/100));
|
| 639 |
|
728 |
|
| 640 |
#print (val.nlc-subsidy+(val.courierCost)*(1+(spm.serviceTax/100))*(1+(val.vatRate/100))+(15+val.otherCost)*(1+(val.vatRate)/100))
|
729 |
#print (val.nlc-subsidy+(val.courierCost)*(1+(spm.serviceTax/100))*(1+(val.vatRate/100))+(15+val.otherCost)*(1+(val.vatRate)/100))
|
| 641 |
#print (1-(spm.commission/100+spm.emiFee/100)*(1+(spm.serviceTax/100))*(1+(val.vatRate)/100)-(spm.returnProvision/100)*(1+(val.vatRate)/100))
|
730 |
#print (1-(spm.commission/100+spm.emiFee/100)*(1+(spm.serviceTax/100))*(1+(val.vatRate)/100)-(spm.returnProvision/100)*(1+(val.vatRate)/100))
|
| 642 |
return round(lowestPossibleSp,2)
|
731 |
return round(lowestPossibleSp,2)
|
| 643 |
|
732 |
|
| Line 709... |
Line 798... |
| 709 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
798 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
| 710 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
799 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
| 711 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
800 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
| 712 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
801 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
| 713 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
802 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
| - |
|
803 |
if (amDetails.lowestMfnOffer < amDetails.lowestFbaOffer or amDetails.lowestMfnOffer < amazonScrapingHistory.promoPrice) and amDetails.isLowestMfn:
|
| - |
|
804 |
amazonScrapingHistory.cheapestMfnCount = True
|
| - |
|
805 |
else:
|
| - |
|
806 |
amazonScrapingHistory.cheapestMfnCount = False
|
| 714 |
amazonScrapingHistory.wanlc = val.nlc
|
807 |
amazonScrapingHistory.wanlc = val.nlc
|
| 715 |
amazonScrapingHistory.otherCost = val.otherCost
|
808 |
amazonScrapingHistory.otherCost = val.otherCost
|
| 716 |
amazonScrapingHistory.commission = spm.commission
|
809 |
amazonScrapingHistory.commission = spm.commission
|
| 717 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
810 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
| 718 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
811 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
| Line 762... |
Line 855... |
| 762 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
855 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
| 763 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
856 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
| 764 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
857 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
| 765 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
858 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
| 766 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
859 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
| - |
|
860 |
amazonScrapingHistory.cheapestMfnCount = False
|
| 767 |
amazonScrapingHistory.otherCost = val.otherCost
|
861 |
amazonScrapingHistory.otherCost = val.otherCost
|
| 768 |
amazonScrapingHistory.wanlc = val.nlc
|
862 |
amazonScrapingHistory.wanlc = val.nlc
|
| 769 |
amazonScrapingHistory.commission = spm.commission
|
863 |
amazonScrapingHistory.commission = spm.commission
|
| 770 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
864 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
| 771 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
865 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
| Line 774... |
Line 868... |
| 774 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
868 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
| 775 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
869 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
| 776 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.BUY_BOX
|
870 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.BUY_BOX
|
| 777 |
amazonScrapingHistory.timestamp = timestamp
|
871 |
amazonScrapingHistory.timestamp = timestamp
|
| 778 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
872 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
| 779 |
proposed_sp = max(amDetails.secondLowestSellerSp - max((20, amDetails.secondLowestSellerSp*0.002)), amPricing.lowestPossibleSp)
|
873 |
proposed_sp = max(amDetails.secondLowestSellerSp - 1, amPricing.lowestPossibleSp)
|
| 780 |
if amazonScrapingHistory.isPromotion:
|
874 |
if amazonScrapingHistory.isPromotion:
|
| 781 |
if amazonLongTermActivePromotions.has_key(val.sku):
|
875 |
if amazonLongTermActivePromotions.has_key(val.sku):
|
| 782 |
proposed_sp = min(proposed_sp,(amazonLongTermActivePromotions.get(val.sku)).salePrice)
|
876 |
proposed_sp = min(proposed_sp,(amazonLongTermActivePromotions.get(val.sku)).salePrice)
|
| 783 |
else:
|
877 |
else:
|
| 784 |
proposed_sp = min(proposed_sp,(amazonShortTermActivePromotions.get(val.sku)).salePrice)
|
878 |
proposed_sp = min(proposed_sp,(amazonShortTermActivePromotions.get(val.sku)).salePrice)
|
| Line 827... |
Line 921... |
| 827 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
921 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
| 828 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
922 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
| 829 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
923 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
| 830 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
924 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
| 831 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
925 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
| - |
|
926 |
amazonScrapingHistory.isLowestMfnIgnored = amDetails.isLowestMfnIgnored
|
| - |
|
927 |
amazonScrapingHistory.isLowestMfn = amDetails.isLowestMfn
|
| - |
|
928 |
amazonScrapingHistory.isLowestFba = amDetails.isLowestFba
|
| - |
|
929 |
amazonScrapingHistory.lowestMfnIgnoredOffer =amDetails.lowestMfnIgnoredOffer
|
| - |
|
930 |
amazonScrapingHistory.lowestMfnOffer = amDetails.lowestMfnOffer
|
| - |
|
931 |
amazonScrapingHistory.lowestFbaOffer = amDetails.lowestFbaOffer
|
| - |
|
932 |
amazonScrapingHistory.competitivePrice = amDetails.competitivePrice
|
| - |
|
933 |
if (amDetails.lowestMfnOffer < amDetails.lowestFbaOffer or amDetails.lowestMfnOffer < amazonScrapingHistory.promoPrice) and amDetails.isLowestMfn:
|
| - |
|
934 |
amazonScrapingHistory.cheapestMfnCount = True
|
| - |
|
935 |
else:
|
| - |
|
936 |
amazonScrapingHistory.cheapestMfnCount = False
|
| 832 |
amazonScrapingHistory.otherCost = val.otherCost
|
937 |
amazonScrapingHistory.otherCost = val.otherCost
|
| 833 |
amazonScrapingHistory.wanlc = val.nlc
|
938 |
amazonScrapingHistory.wanlc = val.nlc
|
| 834 |
amazonScrapingHistory.commission = spm.commission
|
939 |
amazonScrapingHistory.commission = spm.commission
|
| 835 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
940 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
| 836 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
941 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
| Line 839... |
Line 944... |
| 839 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
944 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
| 840 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
945 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
| 841 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.AMONG_CHEAPEST_CAN_COMPETE
|
946 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.AMONG_CHEAPEST_CAN_COMPETE
|
| 842 |
amazonScrapingHistory.timestamp = timestamp
|
947 |
amazonScrapingHistory.timestamp = timestamp
|
| 843 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
948 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
| 844 |
proposed_sp = max(amDetails.lowestSellerSp - max((5, amDetails.lowestSellerSp*0.001)), amPricing.lowestPossibleSp)
|
949 |
proposed_sp = max(amDetails.competitivePrice - 1, amPricing.lowestPossibleSp)
|
| 845 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
950 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
| 846 |
amazonScrapingHistory.proposedSp = proposed_sp
|
951 |
amazonScrapingHistory.proposedSp = proposed_sp
|
| 847 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
952 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
| 848 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
953 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
| 849 |
amazonScrapingHistory.avgSale = calculateAverageSale(val.sku) #Last five days
|
954 |
amazonScrapingHistory.avgSale = calculateAverageSale(val.sku) #Last five days
|
| Line 884... |
Line 989... |
| 884 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
989 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
| 885 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
990 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
| 886 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
991 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
| 887 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
992 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
| 888 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
993 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
| - |
|
994 |
amazonScrapingHistory.isLowestMfnIgnored = amDetails.isLowestMfnIgnored
|
| - |
|
995 |
amazonScrapingHistory.isLowestMfn = amDetails.isLowestMfn
|
| - |
|
996 |
amazonScrapingHistory.isLowestFba = amDetails.isLowestFba
|
| - |
|
997 |
amazonScrapingHistory.lowestMfnIgnoredOffer =amDetails.lowestMfnIgnoredOffer
|
| - |
|
998 |
amazonScrapingHistory.lowestMfnOffer = amDetails.lowestMfnOffer
|
| - |
|
999 |
amazonScrapingHistory.lowestFbaOffer = amDetails.lowestFbaOffer
|
| - |
|
1000 |
amazonScrapingHistory.competitivePrice = amDetails.competitivePrice
|
| - |
|
1001 |
if (amDetails.lowestMfnOffer < amDetails.lowestFbaOffer or amDetails.lowestMfnOffer < amazonScrapingHistory.promoPrice) and amDetails.isLowestMfn:
|
| - |
|
1002 |
amazonScrapingHistory.cheapestMfnCount = True
|
| - |
|
1003 |
else:
|
| - |
|
1004 |
amazonScrapingHistory.cheapestMfnCount = False
|
| 889 |
amazonScrapingHistory.otherCost = val.otherCost
|
1005 |
amazonScrapingHistory.otherCost = val.otherCost
|
| 890 |
amazonScrapingHistory.wanlc = val.nlc
|
1006 |
amazonScrapingHistory.wanlc = val.nlc
|
| 891 |
amazonScrapingHistory.commission = spm.commission
|
1007 |
amazonScrapingHistory.commission = spm.commission
|
| 892 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
1008 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
| 893 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
1009 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
| Line 896... |
Line 1012... |
| 896 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
1012 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
| 897 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
1013 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
| 898 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.COMPETITIVE
|
1014 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.COMPETITIVE
|
| 899 |
amazonScrapingHistory.timestamp = timestamp
|
1015 |
amazonScrapingHistory.timestamp = timestamp
|
| 900 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
1016 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
| 901 |
proposed_sp = max(amDetails.lowestSellerSp - max((5, amDetails.lowestSellerSp*0.001)), amPricing.lowestPossibleSp)
|
1017 |
proposed_sp = max(amDetails.competitivePrice - 1, amPricing.lowestPossibleSp)
|
| 902 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
1018 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
| 903 |
amazonScrapingHistory.proposedSp = proposed_sp
|
1019 |
amazonScrapingHistory.proposedSp = proposed_sp
|
| 904 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
1020 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
| 905 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
1021 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
| 906 |
amazonScrapingHistory.avgSale = calculateAverageSale(val.sku) #Last five days
|
1022 |
amazonScrapingHistory.avgSale = calculateAverageSale(val.sku) #Last five days
|
| Line 941... |
Line 1057... |
| 941 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
1057 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
| 942 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
1058 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
| 943 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
1059 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
| 944 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
1060 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
| 945 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
1061 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
| - |
|
1062 |
amazonScrapingHistory.isLowestMfnIgnored = amDetails.isLowestMfnIgnored
|
| - |
|
1063 |
amazonScrapingHistory.isLowestMfn = amDetails.isLowestMfn
|
| - |
|
1064 |
amazonScrapingHistory.isLowestFba = amDetails.isLowestFba
|
| - |
|
1065 |
amazonScrapingHistory.lowestMfnIgnoredOffer =amDetails.lowestMfnIgnoredOffer
|
| - |
|
1066 |
amazonScrapingHistory.lowestMfnOffer = amDetails.lowestMfnOffer
|
| - |
|
1067 |
amazonScrapingHistory.lowestFbaOffer = amDetails.lowestFbaOffer
|
| - |
|
1068 |
amazonScrapingHistory.competitivePrice = amDetails.competitivePrice
|
| - |
|
1069 |
if (amDetails.lowestMfnOffer < amDetails.lowestFbaOffer or amDetails.lowestMfnOffer < amazonScrapingHistory.promoPrice) and amDetails.isLowestMfn:
|
| - |
|
1070 |
amazonScrapingHistory.cheapestMfnCount = True
|
| - |
|
1071 |
else:
|
| - |
|
1072 |
amazonScrapingHistory.cheapestMfnCount = False
|
| 946 |
amazonScrapingHistory.otherCost = val.otherCost
|
1073 |
amazonScrapingHistory.otherCost = val.otherCost
|
| 947 |
amazonScrapingHistory.wanlc = val.nlc
|
1074 |
amazonScrapingHistory.wanlc = val.nlc
|
| 948 |
amazonScrapingHistory.commission = spm.commission
|
1075 |
amazonScrapingHistory.commission = spm.commission
|
| 949 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
1076 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
| 950 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
1077 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
| Line 953... |
Line 1080... |
| 953 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
1080 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
| 954 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
1081 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
| 955 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.ALMOST_COMPETE
|
1082 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.ALMOST_COMPETE
|
| 956 |
amazonScrapingHistory.timestamp = timestamp
|
1083 |
amazonScrapingHistory.timestamp = timestamp
|
| 957 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
1084 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
| 958 |
proposed_sp = min(amDetails.lowestSellerSp*(1+.01),amPricing.lowestPossibleSp)
|
1085 |
proposed_sp = min(amDetails.competitivePrice*(1+.01),amPricing.lowestPossibleSp)
|
| 959 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
1086 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
| 960 |
#target_nlc = proposed_tp - amPricing.lowestPossibleTp + val.nlc
|
1087 |
#target_nlc = proposed_tp - amPricing.lowestPossibleTp + val.nlc
|
| 961 |
amazonScrapingHistory.proposedSp = proposed_sp
|
1088 |
amazonScrapingHistory.proposedSp = proposed_sp
|
| 962 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
1089 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
| 963 |
#amazonScrapingHistory.targetNlc = target_nlc
|
1090 |
#amazonScrapingHistory.targetNlc = target_nlc
|
| Line 1001... |
Line 1128... |
| 1001 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
1128 |
amazonScrapingHistory.secondLowestSellerType = amDetails.secondLowestSellerType
|
| 1002 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
1129 |
amazonScrapingHistory.thirdLowestSellerSp = amDetails.thirdLowestSellerSp
|
| 1003 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
1130 |
amazonScrapingHistory.thirdLowestSellerShippingTime = amDetails.thirdLowestSellerShippingTime
|
| 1004 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
1131 |
amazonScrapingHistory.thirdLowestSellerRating = amDetails.thirdLowestSellerRating
|
| 1005 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
1132 |
amazonScrapingHistory.thirdLowestSellerType = amDetails.thirdLowestSellerType
|
| - |
|
1133 |
amazonScrapingHistory.isLowestMfnIgnored = amDetails.isLowestMfnIgnored
|
| - |
|
1134 |
amazonScrapingHistory.isLowestMfn = amDetails.isLowestMfn
|
| - |
|
1135 |
amazonScrapingHistory.isLowestFba = amDetails.isLowestFba
|
| - |
|
1136 |
amazonScrapingHistory.lowestMfnIgnoredOffer =amDetails.lowestMfnIgnoredOffer
|
| - |
|
1137 |
amazonScrapingHistory.lowestMfnOffer = amDetails.lowestMfnOffer
|
| - |
|
1138 |
amazonScrapingHistory.lowestFbaOffer = amDetails.lowestFbaOffer
|
| - |
|
1139 |
if (amDetails.lowestMfnOffer < amDetails.lowestFbaOffer or amDetails.lowestMfnOffer < amazonScrapingHistory.promoPrice) and amDetails.isLowestMfn:
|
| - |
|
1140 |
amazonScrapingHistory.cheapestMfnCount = True
|
| - |
|
1141 |
else:
|
| - |
|
1142 |
amazonScrapingHistory.cheapestMfnCount = False
|
| - |
|
1143 |
amazonScrapingHistory.competitivePrice = amDetails.competitivePrice
|
| 1006 |
amazonScrapingHistory.otherCost = val.otherCost
|
1144 |
amazonScrapingHistory.otherCost = val.otherCost
|
| 1007 |
amazonScrapingHistory.wanlc = val.nlc
|
1145 |
amazonScrapingHistory.wanlc = val.nlc
|
| 1008 |
amazonScrapingHistory.commission = spm.commission
|
1146 |
amazonScrapingHistory.commission = spm.commission
|
| 1009 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
1147 |
amazonScrapingHistory.competitorCommission = spm.competitorCommissionOther
|
| 1010 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
1148 |
amazonScrapingHistory.returnProvision = spm.returnProvision
|
| Line 1013... |
Line 1151... |
| 1013 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
1151 |
amazonScrapingHistory.runType = RunType._NAMES_TO_VALUES.get(runType)
|
| 1014 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
1152 |
amazonScrapingHistory.totalSeller = amDetails.totalSeller
|
| 1015 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.CANT_COMPETE
|
1153 |
amazonScrapingHistory.competitiveCategory = CompetitionCategory.CANT_COMPETE
|
| 1016 |
amazonScrapingHistory.timestamp = timestamp
|
1154 |
amazonScrapingHistory.timestamp = timestamp
|
| 1017 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
1155 |
amazonScrapingHistory.multipleListings = amDetails.multipleListings
|
| 1018 |
proposed_sp = amDetails.lowestSellerSp - max(5, amDetails.lowestSellerSp*0.001)
|
1156 |
proposed_sp = amDetails.competitivePrice - max(5, amDetails.competitivePrice*0.001)
|
| 1019 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
1157 |
#proposed_tp = getTargetTp(proposed_sp,spm,val)
|
| 1020 |
#target_nlc = proposed_tp - amPricing.lowestPossibleTp + val.nlc
|
1158 |
#target_nlc = proposed_tp - amPricing.lowestPossibleTp + val.nlc
|
| 1021 |
amazonScrapingHistory.proposedSp = proposed_sp
|
1159 |
amazonScrapingHistory.proposedSp = proposed_sp
|
| 1022 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
1160 |
#amazonScrapingHistory.proposedTp = proposed_tp
|
| 1023 |
#amazonScrapingHistory.targetNlc = target_nlc
|
1161 |
#amazonScrapingHistory.targetNlc = target_nlc
|
| Line 1098... |
Line 1236... |
| 1098 |
sheet.write(0, 19, "Second Lowest Seller Rating", heading_xf)
|
1236 |
sheet.write(0, 19, "Second Lowest Seller Rating", heading_xf)
|
| 1099 |
sheet.write(0, 20, "Second Lowest Seller Shipping Time", heading_xf)
|
1237 |
sheet.write(0, 20, "Second Lowest Seller Shipping Time", heading_xf)
|
| 1100 |
sheet.write(0, 21, "Third Lowest Seller SP", heading_xf)
|
1238 |
sheet.write(0, 21, "Third Lowest Seller SP", heading_xf)
|
| 1101 |
sheet.write(0, 22, "Third Lowest Seller Rating", heading_xf)
|
1239 |
sheet.write(0, 22, "Third Lowest Seller Rating", heading_xf)
|
| 1102 |
sheet.write(0, 23, "Third Lowest Seller Shipping Time", heading_xf)
|
1240 |
sheet.write(0, 23, "Third Lowest Seller Shipping Time", heading_xf)
|
| - |
|
1241 |
sheet.write(0, 24, "Lowest MFN Ignored", heading_xf)
|
| - |
|
1242 |
sheet.write(0, 25, "Lowest MFN", heading_xf)
|
| - |
|
1243 |
sheet.write(0, 26, "Lowest FBA", heading_xf)
|
| - |
|
1244 |
sheet.write(0, 27, "Competitive Price", heading_xf)
|
| 1103 |
sheet.write(0, 24, "Other Cost", heading_xf)
|
1245 |
sheet.write(0, 28, "Other Cost", heading_xf)
|
| 1104 |
sheet.write(0, 25, "WANLC", heading_xf)
|
1246 |
sheet.write(0, 29, "WANLC", heading_xf)
|
| 1105 |
sheet.write(0, 26, "Subsidy", heading_xf)
|
1247 |
sheet.write(0, 30, "Subsidy", heading_xf)
|
| 1106 |
sheet.write(0, 27, "Commission", heading_xf)
|
1248 |
sheet.write(0, 31, "Commission", heading_xf)
|
| 1107 |
sheet.write(0, 28, "Competitor Commission", heading_xf)
|
1249 |
sheet.write(0, 32, "Competitor Commission", heading_xf)
|
| 1108 |
sheet.write(0, 29, "Return Provision", heading_xf)
|
1250 |
sheet.write(0, 33, "Return Provision", heading_xf)
|
| 1109 |
sheet.write(0, 30, "Vat Rate", heading_xf)
|
1251 |
sheet.write(0, 34, "Vat Rate", heading_xf)
|
| 1110 |
sheet.write(0, 31, "Margin", heading_xf)
|
1252 |
sheet.write(0, 35, "Margin", heading_xf)
|
| 1111 |
sheet.write(0, 32, "Risky", heading_xf)
|
- |
|
| 1112 |
sheet.write(0, 33, "Proposed Sp", heading_xf)
|
1253 |
sheet.write(0, 36, "Proposed Sp", heading_xf)
|
| 1113 |
sheet.write(0, 34, "Avg Sale", heading_xf)
|
1254 |
sheet.write(0, 37, "Avg Sale", heading_xf)
|
| 1114 |
sheet.write(0, 35, "Sales History", heading_xf)
|
1255 |
sheet.write(0, 38, "Sales History", heading_xf)
|
| 1115 |
|
1256 |
|
| 1116 |
def getPackagingCost(data):
|
1257 |
def getPackagingCost(data):
|
| 1117 |
#TODO : Get packagingCost from marketplaceitems table
|
1258 |
#TODO : Get packagingCost from marketplaceitems table
|
| 1118 |
return 15
|
1259 |
return 15
|
| 1119 |
|
1260 |
|
| Line 1172... |
Line 1313... |
| 1172 |
return 0
|
1313 |
return 0
|
| 1173 |
else:
|
1314 |
else:
|
| 1174 |
return round(myVat)
|
1315 |
return round(myVat)
|
| 1175 |
|
1316 |
|
| 1176 |
def getCategory(data):
|
1317 |
def getCategory(data):
|
| 1177 |
global categoryMap
|
- |
|
| 1178 |
return categoryMap[data.category]
|
1318 |
return categoryMap[data.category]
|
| 1179 |
|
1319 |
|
| 1180 |
def writeReport(timestamp,autoDecreaseItems,autoIncreaseItems,previousAutoFav,nowAutoFav,runType):
|
1320 |
def writeReport(timestamp,autoDecreaseItems,autoIncreaseItems,previousAutoFav,nowAutoFav,runType):
|
| 1181 |
wbk = xlwt.Workbook()
|
1321 |
wbk = xlwt.Workbook()
|
| 1182 |
sheet = wbk.add_sheet('Can\'t Compete')
|
1322 |
sheet = wbk.add_sheet('Can\'t Compete')
|
| Line 1264... |
Line 1404... |
| 1264 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
1404 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
| 1265 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
1405 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
| 1266 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
1406 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
| 1267 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
1407 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
| 1268 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
1408 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
| - |
|
1409 |
sheet.write(sheet_iterator, 24, amScraping.lowestMfnIgnoredOffer)
|
| - |
|
1410 |
sheet.write(sheet_iterator, 25, amScraping.lowestMfnOffer)
|
| - |
|
1411 |
sheet.write(sheet_iterator, 26, amScraping.lowestFbaOffer)
|
| - |
|
1412 |
sheet.write(sheet_iterator, 27, amScraping.competitivePrice)
|
| 1269 |
sheet.write(sheet_iterator, 24, amScraping.otherCost)
|
1413 |
sheet.write(sheet_iterator, 28, amScraping.otherCost)
|
| 1270 |
sheet.write(sheet_iterator, 25, amScraping.wanlc)
|
1414 |
sheet.write(sheet_iterator, 29, amScraping.wanlc)
|
| 1271 |
sheet.write(sheet_iterator, 26, amScraping.subsidy)
|
1415 |
sheet.write(sheet_iterator, 30, amScraping.subsidy)
|
| 1272 |
sheet.write(sheet_iterator, 27, amScraping.commission)
|
1416 |
sheet.write(sheet_iterator, 31, amScraping.commission)
|
| 1273 |
sheet.write(sheet_iterator, 28, amScraping.competitorCommission)
|
1417 |
sheet.write(sheet_iterator, 32, amScraping.competitorCommission)
|
| 1274 |
sheet.write(sheet_iterator, 29, amScraping.returnProvision)
|
1418 |
sheet.write(sheet_iterator, 33, amScraping.returnProvision)
|
| 1275 |
sheet.write(sheet_iterator, 30, amScraping.vatRate)
|
1419 |
sheet.write(sheet_iterator, 34, amScraping.vatRate)
|
| 1276 |
sheet.write(sheet_iterator, 31, getMargin(amScraping))
|
1420 |
sheet.write(sheet_iterator, 35, getMargin(amScraping))
|
| 1277 |
sheet.write(sheet_iterator, 32, item.risky)
|
- |
|
| 1278 |
sheet.write(sheet_iterator, 33, amScraping.proposedSp)
|
1421 |
sheet.write(sheet_iterator, 36, amScraping.proposedSp)
|
| 1279 |
sheet.write(sheet_iterator, 34, amScraping.avgSale)
|
1422 |
sheet.write(sheet_iterator, 37, amScraping.avgSale)
|
| 1280 |
sheet.write(sheet_iterator, 35, getOosString(saleMap.get(sku)))
|
1423 |
sheet.write(sheet_iterator, 38, getOosString(saleMap.get(sku)))
|
| 1281 |
sheet_iterator+=1
|
1424 |
sheet_iterator+=1
|
| 1282 |
#TODO : Take excell sheet generation code inside a function
|
1425 |
#TODO : Take excell sheet generation code inside a function
|
| 1283 |
sheet = wbk.add_sheet('Competitive')
|
1426 |
sheet = wbk.add_sheet('Competitive')
|
| 1284 |
xstr = lambda s: s or ""
|
1427 |
xstr = lambda s: s or ""
|
| 1285 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
1428 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
| 1286 |
|
1429 |
|
| 1287 |
excel_integer_format = '0'
|
1430 |
excel_integer_format = '0'
|
| 1288 |
integer_style = xlwt.XFStyle()
|
1431 |
integer_style = xlwt.XFStyle()
|
| 1289 |
integer_style.num_format_str = excel_integer_format
|
1432 |
integer_style.num_format_str = excel_integer_format
|
| 1290 |
|
1433 |
|
| 1291 |
writeheaders(sheet,heading_xf)
|
1434 |
writeheaders(sheet,heading_xf)
|
| 1292 |
sheet.write(0, 36, "Decision", heading_xf)
|
1435 |
sheet.write(0, 39, "Decision", heading_xf)
|
| 1293 |
sheet.write(0, 37, "Reason", heading_xf)
|
1436 |
sheet.write(0, 40, "Reason", heading_xf)
|
| 1294 |
sheet.write(0, 38, "Updated Price", heading_xf)
|
1437 |
sheet.write(0, 41, "Updated Price", heading_xf)
|
| 1295 |
|
1438 |
|
| 1296 |
sheet_iterator = 1
|
1439 |
sheet_iterator = 1
|
| 1297 |
competitiveItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.COMPETITIVE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
1440 |
competitiveItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.COMPETITIVE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
| 1298 |
for competitiveItem in competitiveItems:
|
1441 |
for competitiveItem in competitiveItems:
|
| 1299 |
amScraping = competitiveItem[0]
|
1442 |
amScraping = competitiveItem[0]
|
| Line 1332... |
Line 1475... |
| 1332 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
1475 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
| 1333 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
1476 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
| 1334 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
1477 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
| 1335 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
1478 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
| 1336 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
1479 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
| - |
|
1480 |
sheet.write(sheet_iterator, 24, amScraping.lowestMfnIgnoredOffer)
|
| - |
|
1481 |
sheet.write(sheet_iterator, 25, amScraping.lowestMfnOffer)
|
| - |
|
1482 |
sheet.write(sheet_iterator, 26, amScraping.lowestFbaOffer)
|
| - |
|
1483 |
sheet.write(sheet_iterator, 27, amScraping.competitivePrice)
|
| 1337 |
sheet.write(sheet_iterator, 24, amScraping.otherCost)
|
1484 |
sheet.write(sheet_iterator, 28, amScraping.otherCost)
|
| 1338 |
sheet.write(sheet_iterator, 25, amScraping.wanlc)
|
1485 |
sheet.write(sheet_iterator, 29, amScraping.wanlc)
|
| 1339 |
sheet.write(sheet_iterator, 26, amScraping.subsidy)
|
1486 |
sheet.write(sheet_iterator, 30, amScraping.subsidy)
|
| 1340 |
sheet.write(sheet_iterator, 27, amScraping.commission)
|
1487 |
sheet.write(sheet_iterator, 31, amScraping.commission)
|
| 1341 |
sheet.write(sheet_iterator, 28, amScraping.competitorCommission)
|
1488 |
sheet.write(sheet_iterator, 32, amScraping.competitorCommission)
|
| 1342 |
sheet.write(sheet_iterator, 29, amScraping.returnProvision)
|
1489 |
sheet.write(sheet_iterator, 33, amScraping.returnProvision)
|
| 1343 |
sheet.write(sheet_iterator, 30, amScraping.vatRate)
|
1490 |
sheet.write(sheet_iterator, 34, amScraping.vatRate)
|
| 1344 |
sheet.write(sheet_iterator, 31, getMargin(amScraping))
|
1491 |
sheet.write(sheet_iterator, 35, getMargin(amScraping))
|
| 1345 |
sheet.write(sheet_iterator, 32, item.risky)
|
- |
|
| 1346 |
sheet.write(sheet_iterator, 33, amScraping.proposedSp)
|
1492 |
sheet.write(sheet_iterator, 36, amScraping.proposedSp)
|
| 1347 |
sheet.write(sheet_iterator, 34, amScraping.avgSale)
|
1493 |
sheet.write(sheet_iterator, 37, amScraping.avgSale)
|
| 1348 |
sheet.write(sheet_iterator, 35, getOosString(saleMap.get(sku)))
|
1494 |
sheet.write(sheet_iterator, 38, getOosString(saleMap.get(sku)))
|
| 1349 |
if amScraping.decision is None:
|
1495 |
if amScraping.decision is None:
|
| 1350 |
sheet.write(sheet_iterator, 36, 'Auto Pricing Inactive')
|
1496 |
sheet.write(sheet_iterator, 39, 'Auto Pricing Inactive')
|
| 1351 |
sheet_iterator+=1
|
1497 |
sheet_iterator+=1
|
| 1352 |
continue
|
1498 |
continue
|
| 1353 |
sheet.write(sheet_iterator, 36, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
1499 |
sheet.write(sheet_iterator, 39, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
| 1354 |
sheet.write(sheet_iterator, 37, amScraping.reason)
|
1500 |
sheet.write(sheet_iterator, 40, amScraping.reason)
|
| 1355 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
1501 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
| 1356 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.proposedSp))
|
1502 |
sheet.write(sheet_iterator, 41, math.ceil(amScraping.proposedSp))
|
| 1357 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
1503 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
| 1358 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
1504 |
sheet.write(sheet_iterator, 41, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
| 1359 |
sheet_iterator+=1
|
1505 |
sheet_iterator+=1
|
| 1360 |
|
1506 |
|
| 1361 |
sheet = wbk.add_sheet('Almost Competitive')
|
1507 |
sheet = wbk.add_sheet('Almost Competitive')
|
| 1362 |
xstr = lambda s: s or ""
|
1508 |
xstr = lambda s: s or ""
|
| 1363 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
1509 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
| 1364 |
|
1510 |
|
| 1365 |
excel_integer_format = '0'
|
1511 |
excel_integer_format = '0'
|
| 1366 |
integer_style = xlwt.XFStyle()
|
1512 |
integer_style = xlwt.XFStyle()
|
| 1367 |
integer_style.num_format_str = excel_integer_format
|
1513 |
integer_style.num_format_str = excel_integer_format
|
| 1368 |
writeheaders(sheet,heading_xf)
|
1514 |
writeheaders(sheet,heading_xf)
|
| 1369 |
sheet.write(0, 36, "Decision", heading_xf)
|
1515 |
sheet.write(0, 39, "Decision", heading_xf)
|
| 1370 |
sheet.write(0, 37, "Reason", heading_xf)
|
1516 |
sheet.write(0, 40, "Reason", heading_xf)
|
| 1371 |
sheet.write(0, 38, "Updated Price", heading_xf)
|
1517 |
sheet.write(0, 41, "Updated Price", heading_xf)
|
| 1372 |
sheet_iterator = 1
|
1518 |
sheet_iterator = 1
|
| 1373 |
almostCompetitiveItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.ALMOST_COMPETE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
1519 |
almostCompetitiveItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.ALMOST_COMPETE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
| 1374 |
for almostCompetitiveItem in almostCompetitiveItems:
|
1520 |
for almostCompetitiveItem in almostCompetitiveItems:
|
| 1375 |
amScraping = almostCompetitiveItem[0]
|
1521 |
amScraping = almostCompetitiveItem[0]
|
| 1376 |
item = almostCompetitiveItem[1]
|
1522 |
item = almostCompetitiveItem[1]
|
| Line 1408... |
Line 1554... |
| 1408 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
1554 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
| 1409 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
1555 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
| 1410 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
1556 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
| 1411 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
1557 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
| 1412 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
1558 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
| - |
|
1559 |
sheet.write(sheet_iterator, 24, amScraping.lowestMfnIgnoredOffer)
|
| - |
|
1560 |
sheet.write(sheet_iterator, 25, amScraping.lowestMfnOffer)
|
| - |
|
1561 |
sheet.write(sheet_iterator, 26, amScraping.lowestFbaOffer)
|
| - |
|
1562 |
sheet.write(sheet_iterator, 27, amScraping.competitivePrice)
|
| 1413 |
sheet.write(sheet_iterator, 24, amScraping.otherCost)
|
1563 |
sheet.write(sheet_iterator, 28, amScraping.otherCost)
|
| 1414 |
sheet.write(sheet_iterator, 25, amScraping.wanlc)
|
1564 |
sheet.write(sheet_iterator, 29, amScraping.wanlc)
|
| 1415 |
sheet.write(sheet_iterator, 26, amScraping.subsidy)
|
1565 |
sheet.write(sheet_iterator, 30, amScraping.subsidy)
|
| 1416 |
sheet.write(sheet_iterator, 27, amScraping.commission)
|
1566 |
sheet.write(sheet_iterator, 31, amScraping.commission)
|
| 1417 |
sheet.write(sheet_iterator, 28, amScraping.competitorCommission)
|
1567 |
sheet.write(sheet_iterator, 32, amScraping.competitorCommission)
|
| 1418 |
sheet.write(sheet_iterator, 29, amScraping.returnProvision)
|
1568 |
sheet.write(sheet_iterator, 33, amScraping.returnProvision)
|
| 1419 |
sheet.write(sheet_iterator, 30, amScraping.vatRate)
|
1569 |
sheet.write(sheet_iterator, 34, amScraping.vatRate)
|
| 1420 |
sheet.write(sheet_iterator, 31, getMargin(amScraping))
|
1570 |
sheet.write(sheet_iterator, 35, getMargin(amScraping))
|
| 1421 |
sheet.write(sheet_iterator, 32, item.risky)
|
- |
|
| 1422 |
sheet.write(sheet_iterator, 33, amScraping.proposedSp)
|
1571 |
sheet.write(sheet_iterator, 36, amScraping.proposedSp)
|
| 1423 |
sheet.write(sheet_iterator, 34, amScraping.avgSale)
|
1572 |
sheet.write(sheet_iterator, 37, amScraping.avgSale)
|
| 1424 |
sheet.write(sheet_iterator, 35, getOosString(saleMap.get(sku)))
|
1573 |
sheet.write(sheet_iterator, 38, getOosString(saleMap.get(sku)))
|
| 1425 |
if amScraping.decision is None:
|
1574 |
if amScraping.decision is None:
|
| 1426 |
sheet.write(sheet_iterator, 36, 'Auto Pricing Inactive')
|
1575 |
sheet.write(sheet_iterator, 39, 'Auto Pricing Inactive')
|
| 1427 |
sheet_iterator+=1
|
1576 |
sheet_iterator+=1
|
| 1428 |
continue
|
1577 |
continue
|
| 1429 |
sheet.write(sheet_iterator, 36, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
1578 |
sheet.write(sheet_iterator, 39, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
| 1430 |
sheet.write(sheet_iterator, 37, amScraping.reason)
|
1579 |
sheet.write(sheet_iterator, 40, amScraping.reason)
|
| 1431 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
1580 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
| 1432 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.proposedSp))
|
1581 |
sheet.write(sheet_iterator, 41, math.ceil(amScraping.proposedSp))
|
| 1433 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
1582 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
| 1434 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
1583 |
sheet.write(sheet_iterator, 41, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
| 1435 |
sheet_iterator+=1
|
1584 |
sheet_iterator+=1
|
| 1436 |
|
1585 |
|
| 1437 |
sheet = wbk.add_sheet('Among Cheapest')
|
1586 |
sheet = wbk.add_sheet('Among Cheapest')
|
| 1438 |
xstr = lambda s: s or ""
|
1587 |
xstr = lambda s: s or ""
|
| 1439 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
1588 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
| 1440 |
|
1589 |
|
| 1441 |
excel_integer_format = '0'
|
1590 |
excel_integer_format = '0'
|
| 1442 |
integer_style = xlwt.XFStyle()
|
1591 |
integer_style = xlwt.XFStyle()
|
| 1443 |
integer_style.num_format_str = excel_integer_format
|
1592 |
integer_style.num_format_str = excel_integer_format
|
| 1444 |
writeheaders(sheet,heading_xf)
|
1593 |
writeheaders(sheet,heading_xf)
|
| 1445 |
sheet.write(0, 36, "Decision", heading_xf)
|
1594 |
sheet.write(0, 39, "Decision", heading_xf)
|
| 1446 |
sheet.write(0, 37, "Reason", heading_xf)
|
1595 |
sheet.write(0, 40, "Reason", heading_xf)
|
| 1447 |
sheet.write(0, 38, "Updated Price", heading_xf)
|
1596 |
sheet.write(0, 41, "Updated Price", heading_xf)
|
| 1448 |
sheet_iterator = 1
|
1597 |
sheet_iterator = 1
|
| 1449 |
amongCheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.AMONG_CHEAPEST_CAN_COMPETE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
1598 |
amongCheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.AMONG_CHEAPEST_CAN_COMPETE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
| 1450 |
for amongCheapestItem in amongCheapestItems:
|
1599 |
for amongCheapestItem in amongCheapestItems:
|
| 1451 |
amScraping = amongCheapestItem[0]
|
1600 |
amScraping = amongCheapestItem[0]
|
| 1452 |
item = amongCheapestItem[1]
|
1601 |
item = amongCheapestItem[1]
|
| Line 1484... |
Line 1633... |
| 1484 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
1633 |
sheet.write(sheet_iterator, 19, amScraping.secondLowestSellerRating)
|
| 1485 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
1634 |
sheet.write(sheet_iterator, 20, amScraping.secondLowestSellerShippingTime)
|
| 1486 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
1635 |
sheet.write(sheet_iterator, 21, amScraping.thirdLowestSellerSp)
|
| 1487 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
1636 |
sheet.write(sheet_iterator, 22, amScraping.thirdLowestSellerRating)
|
| 1488 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
1637 |
sheet.write(sheet_iterator, 23, amScraping.thirdLowestSellerShippingTime)
|
| - |
|
1638 |
sheet.write(sheet_iterator, 24, amScraping.lowestMfnIgnoredOffer)
|
| - |
|
1639 |
sheet.write(sheet_iterator, 25, amScraping.lowestMfnOffer)
|
| - |
|
1640 |
sheet.write(sheet_iterator, 26, amScraping.lowestFbaOffer)
|
| - |
|
1641 |
sheet.write(sheet_iterator, 27, amScraping.competitivePrice)
|
| 1489 |
sheet.write(sheet_iterator, 24, amScraping.otherCost)
|
1642 |
sheet.write(sheet_iterator, 28, amScraping.otherCost)
|
| 1490 |
sheet.write(sheet_iterator, 25, amScraping.wanlc)
|
1643 |
sheet.write(sheet_iterator, 29, amScraping.wanlc)
|
| 1491 |
sheet.write(sheet_iterator, 26, amScraping.subsidy)
|
1644 |
sheet.write(sheet_iterator, 30, amScraping.subsidy)
|
| 1492 |
sheet.write(sheet_iterator, 27, amScraping.commission)
|
1645 |
sheet.write(sheet_iterator, 31, amScraping.commission)
|
| 1493 |
sheet.write(sheet_iterator, 28, amScraping.competitorCommission)
|
1646 |
sheet.write(sheet_iterator, 32, amScraping.competitorCommission)
|
| 1494 |
sheet.write(sheet_iterator, 29, amScraping.returnProvision)
|
1647 |
sheet.write(sheet_iterator, 33, amScraping.returnProvision)
|
| 1495 |
sheet.write(sheet_iterator, 30, amScraping.vatRate)
|
1648 |
sheet.write(sheet_iterator, 34, amScraping.vatRate)
|
| 1496 |
sheet.write(sheet_iterator, 31, getMargin(amScraping))
|
1649 |
sheet.write(sheet_iterator, 35, getMargin(amScraping))
|
| 1497 |
sheet.write(sheet_iterator, 32, item.risky)
|
- |
|
| 1498 |
sheet.write(sheet_iterator, 33, amScraping.proposedSp)
|
1650 |
sheet.write(sheet_iterator, 36, amScraping.proposedSp)
|
| 1499 |
sheet.write(sheet_iterator, 34, amScraping.avgSale)
|
1651 |
sheet.write(sheet_iterator, 37, amScraping.avgSale)
|
| 1500 |
sheet.write(sheet_iterator, 35, getOosString(saleMap.get(sku)))
|
1652 |
sheet.write(sheet_iterator, 38, getOosString(saleMap.get(sku)))
|
| 1501 |
if amScraping.decision is None:
|
1653 |
if amScraping.decision is None:
|
| 1502 |
sheet.write(sheet_iterator, 36, 'Auto Pricing Inactive')
|
1654 |
sheet.write(sheet_iterator, 39, 'Auto Pricing Inactive')
|
| 1503 |
sheet_iterator+=1
|
1655 |
sheet_iterator+=1
|
| 1504 |
continue
|
1656 |
continue
|
| 1505 |
sheet.write(sheet_iterator, 36, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
1657 |
sheet.write(sheet_iterator, 39, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
| 1506 |
sheet.write(sheet_iterator, 37, amScraping.reason)
|
1658 |
sheet.write(sheet_iterator, 40, amScraping.reason)
|
| 1507 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
1659 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
| 1508 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.proposedSp))
|
1660 |
sheet.write(sheet_iterator, 41, math.ceil(amScraping.proposedSp))
|
| 1509 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
1661 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
| 1510 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
1662 |
sheet.write(sheet_iterator, 41, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
| 1511 |
sheet_iterator+=1
|
1663 |
sheet_iterator+=1
|
| 1512 |
|
1664 |
|
| 1513 |
sheet = wbk.add_sheet('Cheapest')
|
1665 |
sheet = wbk.add_sheet('Cheapest')
|
| 1514 |
xstr = lambda s: s or ""
|
1666 |
xstr = lambda s: s or ""
|
| 1515 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
1667 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
| 1516 |
|
1668 |
|
| 1517 |
excel_integer_format = '0'
|
1669 |
excel_integer_format = '0'
|
| 1518 |
integer_style = xlwt.XFStyle()
|
1670 |
integer_style = xlwt.XFStyle()
|
| 1519 |
integer_style.num_format_str = excel_integer_format
|
1671 |
integer_style.num_format_str = excel_integer_format
|
| - |
|
1672 |
sheet.write(0, 0, "Item Id", heading_xf)
|
| - |
|
1673 |
sheet.write(0, 1, "Amazon Sku", heading_xf)
|
| 1520 |
writeheaders(sheet,heading_xf)
|
1674 |
sheet.write(0, 2, "Asin", heading_xf)
|
| - |
|
1675 |
sheet.write(0, 3, "Location", heading_xf)
|
| - |
|
1676 |
sheet.write(0, 4, "Brand", heading_xf)
|
| - |
|
1677 |
sheet.write(0, 5, "Category", heading_xf)
|
| - |
|
1678 |
sheet.write(0, 6, "Product Name", heading_xf)
|
| - |
|
1679 |
sheet.write(0, 7, "Weight", heading_xf)
|
| - |
|
1680 |
sheet.write(0, 8, "Courier Cost", heading_xf)
|
| - |
|
1681 |
sheet.write(0, 9, "Our SP", heading_xf)
|
| - |
|
1682 |
sheet.write(0, 10, "Promo Price", heading_xf)
|
| - |
|
1683 |
sheet.write(0, 11, "Is Promotion", heading_xf)
|
| - |
|
1684 |
sheet.write(0, 12, "Lowest Possible SP", heading_xf)
|
| - |
|
1685 |
sheet.write(0, 13, "Rank", heading_xf)
|
| - |
|
1686 |
sheet.write(0, 14, "Our Inventory", heading_xf)
|
| - |
|
1687 |
sheet.write(0, 15, "Lowest Seller SP", heading_xf)
|
| - |
|
1688 |
sheet.write(0, 16, "Lowest Seller Rating", heading_xf)
|
| - |
|
1689 |
sheet.write(0, 17, "Lowest Seller Shipping Time", heading_xf)
|
| - |
|
1690 |
sheet.write(0, 18, "Second Lowest Seller SP", heading_xf)
|
| - |
|
1691 |
sheet.write(0, 19, "Second Lowest Seller Rating", heading_xf)
|
| - |
|
1692 |
sheet.write(0, 20, "Second Lowest Seller Shipping Time", heading_xf)
|
| - |
|
1693 |
sheet.write(0, 21, "Third Lowest Seller SP", heading_xf)
|
| - |
|
1694 |
sheet.write(0, 22, "Third Lowest Seller Rating", heading_xf)
|
| - |
|
1695 |
sheet.write(0, 23, "Third Lowest Seller Shipping Time", heading_xf)
|
| - |
|
1696 |
sheet.write(0, 24, "Other Cost", heading_xf)
|
| - |
|
1697 |
sheet.write(0, 25, "WANLC", heading_xf)
|
| - |
|
1698 |
sheet.write(0, 26, "Subsidy", heading_xf)
|
| - |
|
1699 |
sheet.write(0, 27, "Commission", heading_xf)
|
| - |
|
1700 |
sheet.write(0, 28, "Competitor Commission", heading_xf)
|
| - |
|
1701 |
sheet.write(0, 29, "Return Provision", heading_xf)
|
| - |
|
1702 |
sheet.write(0, 30, "Vat Rate", heading_xf)
|
| - |
|
1703 |
sheet.write(0, 31, "Margin", heading_xf)
|
| - |
|
1704 |
sheet.write(0, 32, "Proposed Sp", heading_xf)
|
| - |
|
1705 |
sheet.write(0, 33, "Avg Sale", heading_xf)
|
| - |
|
1706 |
sheet.write(0, 34, "Sales History", heading_xf)
|
| 1521 |
sheet.write(0, 36, "Decision", heading_xf)
|
1707 |
sheet.write(0, 35, "Decision", heading_xf)
|
| 1522 |
sheet.write(0, 37, "Reason", heading_xf)
|
1708 |
sheet.write(0, 36, "Reason", heading_xf)
|
| 1523 |
sheet.write(0, 38, "Updated Price", heading_xf)
|
1709 |
sheet.write(0, 37, "Updated Price", heading_xf)
|
| 1524 |
sheet_iterator = 1
|
1710 |
sheet_iterator = 1
|
| 1525 |
cheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.BUY_BOX).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
1711 |
cheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.BUY_BOX).filter(AmazonScrapingHistory.timestamp==timestamp).all()
|
| 1526 |
for cheapestItem in cheapestItems:
|
1712 |
for cheapestItem in cheapestItems:
|
| 1527 |
amScraping = cheapestItem[0]
|
1713 |
amScraping = cheapestItem[0]
|
| 1528 |
item = cheapestItem[1]
|
1714 |
item = cheapestItem[1]
|
| Line 1568... |
Line 1754... |
| 1568 |
sheet.write(sheet_iterator, 27, amScraping.commission)
|
1754 |
sheet.write(sheet_iterator, 27, amScraping.commission)
|
| 1569 |
sheet.write(sheet_iterator, 28, amScraping.competitorCommission)
|
1755 |
sheet.write(sheet_iterator, 28, amScraping.competitorCommission)
|
| 1570 |
sheet.write(sheet_iterator, 29, amScraping.returnProvision)
|
1756 |
sheet.write(sheet_iterator, 29, amScraping.returnProvision)
|
| 1571 |
sheet.write(sheet_iterator, 30, amScraping.vatRate)
|
1757 |
sheet.write(sheet_iterator, 30, amScraping.vatRate)
|
| 1572 |
sheet.write(sheet_iterator, 31, getMargin(amScraping))
|
1758 |
sheet.write(sheet_iterator, 31, getMargin(amScraping))
|
| 1573 |
sheet.write(sheet_iterator, 32, item.risky)
|
- |
|
| 1574 |
sheet.write(sheet_iterator, 33, amScraping.proposedSp)
|
1759 |
sheet.write(sheet_iterator, 32, amScraping.proposedSp)
|
| 1575 |
sheet.write(sheet_iterator, 34, amScraping.avgSale)
|
1760 |
sheet.write(sheet_iterator, 33, amScraping.avgSale)
|
| 1576 |
sheet.write(sheet_iterator, 35, getOosString(saleMap.get(sku)))
|
1761 |
sheet.write(sheet_iterator, 34, getOosString(saleMap.get(sku)))
|
| 1577 |
if amScraping.decision is None:
|
1762 |
if amScraping.decision is None:
|
| 1578 |
sheet.write(sheet_iterator, 36, 'Auto Pricing Inactive')
|
1763 |
sheet.write(sheet_iterator, 35, 'Auto Pricing Inactive')
|
| 1579 |
sheet_iterator+=1
|
1764 |
sheet_iterator+=1
|
| 1580 |
continue
|
1765 |
continue
|
| 1581 |
sheet.write(sheet_iterator, 36, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
1766 |
sheet.write(sheet_iterator, 35, Decision._VALUES_TO_NAMES.get(amScraping.decision))
|
| 1582 |
sheet.write(sheet_iterator, 37, amScraping.reason)
|
1767 |
sheet.write(sheet_iterator, 36, amScraping.reason)
|
| 1583 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
1768 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_DECREMENT_SUCCESS":
|
| 1584 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.proposedSp))
|
1769 |
sheet.write(sheet_iterator, 37, math.ceil(amScraping.proposedSp))
|
| 1585 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
1770 |
if Decision._VALUES_TO_NAMES.get(amScraping.decision) == "AUTO_INCREMENT_SUCCESS":
|
| 1586 |
sheet.write(sheet_iterator, 38, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
1771 |
sheet.write(sheet_iterator, 37, math.ceil(amScraping.promoPrice+max(10,.01*amScraping.promoPrice)))
|
| 1587 |
sheet_iterator+=1
|
1772 |
sheet_iterator+=1
|
| 1588 |
|
1773 |
|
| 1589 |
sheet = wbk.add_sheet('Negative Margin')
|
1774 |
sheet = wbk.add_sheet('Negative Margin')
|
| 1590 |
xstr = lambda s: s or ""
|
1775 |
xstr = lambda s: s or ""
|
| 1591 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
1776 |
heading_xf = xlwt.easyxf('font: bold on; align: wrap off, vert centre, horiz center')
|
| Line 1940... |
Line 2125... |
| 1940 |
|
2125 |
|
| 1941 |
def generateCategoryMap():
|
2126 |
def generateCategoryMap():
|
| 1942 |
global categoryMap
|
2127 |
global categoryMap
|
| 1943 |
result = session.query(Category.id,Category.display_name).all()
|
2128 |
result = session.query(Category.id,Category.display_name).all()
|
| 1944 |
for cat in result:
|
2129 |
for cat in result:
|
| 1945 |
categoryMap[cat.id] = cat.display_name
|
2130 |
categoryMap[cat.id] = cat.display_name
|
| 1946 |
print categoryMap
|
- |
|
| 1947 |
|
2131 |
|
| 1948 |
def main():
|
2132 |
def main():
|
| 1949 |
parser = optparse.OptionParser()
|
2133 |
parser = optparse.OptionParser()
|
| 1950 |
parser.add_option("-t", "--type", dest="runType",
|
2134 |
parser.add_option("-t", "--type", dest="runType",
|
| 1951 |
default="FULL", type="string",
|
2135 |
default="FULL", type="string",
|
| 1952 |
help="Run type FULL or FAVOURITE")
|
2136 |
help="Run type FULL or FAVOURITE")
|
| 1953 |
(options, args) = parser.parse_args()
|
2137 |
(options, args) = parser.parse_args()
|
| 1954 |
if options.runType not in ('FULL','FAVOURITE'):
|
2138 |
if options.runType not in ('FULL','FAVOURITE'):
|
| 1955 |
print "Run type argument illegal."
|
2139 |
print "Run type argument illegal."
|
| 1956 |
sys.exit(1)
|
2140 |
sys.exit(1)
|
| 1957 |
time.sleep(5)
|
2141 |
time.sleep(5)
|
| 1958 |
timestamp = datetime.now()
|
2142 |
timestamp = datetime.now()
|
| 1959 |
generateCategoryMap()
|
2143 |
generateCategoryMap()
|
| 1960 |
fetchFbaSale()
|
2144 |
fetchFbaSale()
|
| 1961 |
itemInfo = populateStuff(timestamp,options.runType)
|
2145 |
itemInfo = populateStuff(timestamp,options.runType)
|
| 1962 |
itemsToPopulate = 0
|
2146 |
itemsToPopulate = 0
|
| Line 1976... |
Line 2160... |
| 1976 |
itemsToPopulate = 20
|
2160 |
itemsToPopulate = 20
|
| 1977 |
else:
|
2161 |
else:
|
| 1978 |
itemsToPopulate = len(itemInfo)
|
2162 |
itemsToPopulate = len(itemInfo)
|
| 1979 |
print "items to popluate"
|
2163 |
print "items to popluate"
|
| 1980 |
print itemsToPopulate
|
2164 |
print itemsToPopulate
|
| 1981 |
exceptionList, negativeMargin, cheapest, amongCheapestAndCanCompete, canCompete, almostCompete, cantCompete = decideCategory(itemInfo[0:itemsToPopulate])
|
2165 |
exceptionList, negativeMargin, cheapest, amongCheapestAndCanCompete, canCompete, almostCompete, cantCompete = decideCategory(itemInfo[0:itemsToPopulate],timestamp)
|
| 1982 |
itemInfo[0:itemsToPopulate] = []
|
2166 |
itemInfo[0:itemsToPopulate] = []
|
| 1983 |
commitExceptionList(exceptionList,timestamp,options.runType)
|
2167 |
commitExceptionList(exceptionList,timestamp,options.runType)
|
| 1984 |
commitNegativeMargin(negativeMargin,timestamp,options.runType)
|
2168 |
commitNegativeMargin(negativeMargin,timestamp,options.runType)
|
| 1985 |
commitCheapest(cheapest,timestamp,options.runType)
|
2169 |
commitCheapest(cheapest,timestamp,options.runType)
|
| 1986 |
commitAmongCheapestAndCanCompete(amongCheapestAndCanCompete,timestamp,options.runType)
|
2170 |
commitAmongCheapestAndCanCompete(amongCheapestAndCanCompete,timestamp,options.runType)
|