├── README.md └── bookValue.py /README.md: -------------------------------------------------------------------------------- 1 | # PricePoint Public 2 | 3 | Built in Python using Amazon, eBay, and Facebook APIs, PricePoint researches and recommends e-commerce arbitrage opportunities. PricePoint helps me find, price, and sell ~$xxk each year of books and other inventory to keep the student loan monster at bay. 4 | 5 | Code here offered as example of book pricing from Amazon sales rank and listed price. Focus is on efficient allocation of capital in a conservative fashion. 6 | 7 | Most of the system focuses on identification of products sold below the target prices determined by this code and other programs like it. 8 | -------------------------------------------------------------------------------- /bookValue.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | #value book given lowest list price and Amazon offer of giftcard 4 | def bookValue(listed, redeem, salesRank): 5 | 6 | depreciation = 0.00 7 | 8 | #sales rank is a proxy for liquidity - depreciation more likely for books that take longer to turn 9 | if salesRank > 100000: 10 | depreciation += 0.35 11 | elif salesRank > 50000: 12 | depreciation += 0.30 13 | elif salesRank > 25000: 14 | depreciation += 0.25 15 | elif salesRank > 10000: 16 | depreciation += 0.20 17 | elif salesRank > 5000: 18 | depreciation += 0.15 19 | elif salesRank > 2500: 20 | depreciation += 0.10 21 | elif salesRank > 1000: 22 | depreciation += 0.05 23 | 24 | #higher priced items more susceptible to price swings 25 | if listed > 100: 26 | depreciation += 0.10 27 | elif listed > 50: 28 | depreciation += 0.05 29 | 30 | #fixed costs and margin 31 | shippingAndBox = 6 32 | profit = 10 33 | 34 | #account for amazon fees 35 | gross = 0.7 * listed 36 | 37 | net = gross - shippingAndBox 38 | 39 | #offer is max(value of amazon gift card, amount expected after margin) 40 | if redeem > net: 41 | offer = 0.7 * redeem 42 | else: 43 | offer = (net * (1 - depreciation)) - profit 44 | 45 | estimatedProfit = listed - offer 46 | 47 | if offer < 5: 48 | return (0,0) 49 | else: 50 | return (offer, estimatedProfit) 51 | 52 | #take csv of price data and generate upper bound of price to pay 53 | def bulkEstimate(): 54 | 55 | #set data/export file 56 | path = "YOUR PATH HERE" 57 | export = "YOUR PATH HERE" 58 | 59 | df = pd.read_csv(path) 60 | 61 | newData = [] 62 | 63 | #iterate over items in sheet, determine offer, record in new dataframe 64 | index = 0 65 | for entries in range(len(df)): 66 | 67 | isbn = str(df["ISBN13"][index]) 68 | isbn = isbn[0:3] + isbn[4:] 69 | 70 | listed = df["Retail"][index] 71 | redeem = df["Trade In"][index] 72 | salesRank = df["Rank"][index] 73 | 74 | index += 1 75 | 76 | (offer, estimatedProfit) = bookValue(listed, redeem, salesRank) 77 | 78 | newData.append((isbn, offer, estimatedProfit)) 79 | 80 | newdf = pd.DataFrame(newData) 81 | newdf.columns = ["ISBN13", "Offer", "Estimated Profit"] 82 | 83 | newdf.to_csv(export, encoding='utf-8', index = False) 84 | 85 | bulkEstimate() 86 | --------------------------------------------------------------------------------