コード例 #1
0
ファイル: app.py プロジェクト: cvd268/hacknyu2019
        # |-----------|
        # 	|------|
    while len(curr_intervals) > 1:
        trend.append(
            [last_start, curr_intervals[1][1],
             get_median(curr_prices)])
        last_start = curr_intervals[1][1]
        curr_prices.remove(curr_intervals[0][-1])
        curr_intervals.pop(0)

    trend.append([last_start, curr_intervals[0][1], get_median(curr_prices)])
    return sorted(trend)


sem3.offers_field("sem3_id", "7JAykYaFyiYscEmcAwYC64")

offers = sem3.get_offers()
price_history = []

print("_______Price History______")
# print(offers['results'])
for elem in offers['results']:
    price_history.append([
        int(elem['firstrecorded_at']),
        int(elem['lastrecorded_at']),
        float(elem['price'])
    ])

price_history = sorted(price_history)
print(price_history)
コード例 #2
0
ファイル: snippet.py プロジェクト: someburner/GistsHub
products = Products(api_key, api_secret)
products.products_field("cat_id", 4992)
products.products_field("brand", "Toshiba")
products.products_field("weight", "gte", 1000000)
products.products_field("weight", "lt", 1500000)
products.products_field("sitedetails", "name", "newegg.com")
products.products_field("sitedetails", "latestoffers", "currency", "USD")
products.products_field("sitedetails", "latestoffers", "price", "gte", 100)
products.cache(5)

for i in products.iter():
    pass
# Build the query

products.categories_field("cat_id", 4992)

# Execute the query
results = products.get_categories()

# View the results of the query

products.offers_field("sem3_id", "4znupRCkN6w2Q4Ke4s6sUC")
products.offers_field("seller", ["LFleurs", "Frys", "Walmart"])
products.offers_field("currency", "USD")
products.offers_field("price", "gte", 30)
products.offers_field("lastrecorded_at", "gte", 1348654600)

results = products.get_offers()

pp.pprint(results)