if int(market['market_currency_id']) == int(originCurrency['id']) and int(market['coin_currency_id']) != int(originCurrency['id']): # relativeCoinValue = market['last_trade']['price'] relativeCoinValue = market['24hr']['price_high'] if relativeCoinValue <= 0: continue # COIN1/ORIGIN_COIN numberOfCoinsBought = originCurrencyAmount/relativeCoinValue route = list() # route.extend(['{:.10f} {:s}'.format(originCurrencyAmount,originCurrency['code']),'{:s} at price {:.10f} to buy {:.10f} coins'.format(market['label'],market['last_trade']['price'],numberOfCoinsBought),0,0,0]) route.extend(['{:.10f} {:s}'.format(originCurrencyAmount,originCurrency['code']),'{:s} at price {:.10f} to buy {:.10f} coins'.format(market['label'],market['24hr']['price_high'],numberOfCoinsBought),0,0,0]) coin1ToCoin2(route, int(market['coin_currency_id']), numberOfCoinsBought) print(tradeRoute) # init() aa = c.market_orderbook(3,1) pprint(aa)
# Scan through all ID's that are of interest count = 5; for x in ID_list: #for x in ['167']: # Check to see if the market actually exists ECK = Cryptsy_Handle.market(x); vol = ECK.values()[0]; vol = vol.values()[6]; vol = vol.values()[1]; # If the market exists, then get the current market data if ( ECK.values()[1] == True and vol > 1.0 ): # Get a list of the current market orders - 5 lowest prices to buy at, and the 5 highest prices to sell at market_orders = Cryptsy_Handle.market_orderbook( x , limit=1 , otype='both' , mine=False ); market_orders = market_orders.values()[0]; buy_orders = market_orders.values()[0]; sell_orders = market_orders.values()[1]; # Check to see if there are actually buy & sell orders # Get the current buy and sell price instant_buy = buy_orders[0].values()[0]; instant_sell = sell_orders[0].values()[0]; # Calculate the percent profit, and the break even sell price profit = (1 - sell_fee ) * ( (1 - buy_fee) * 1 / (instant_buy) ) * instant_sell - 1; BESR = instant_buy / ( (1 - sell_fee) * ( 1 - buy_fee) ); # Get the name of the market - Like LTC/BTC or something