holding if/else condition in live bitcoin trading Python
Arshpreet Singh
arsh840 at gmail.com
Tue Aug 2 05:14:23 EDT 2016
I am making a function that is running in while loop and if/else statements make decisions on based on the condition:
here is code:
def main_call():
while True:
l0_0 = getDiff('btcusd',8)
l1_0 = np.tanh(l0_0*0.8446488687)
l1_1 = np.tanh(l0_0*-0.5674069006)
l1_2 = np.tanh(l0_0*0.8676766445)
<lots of calculation here to get value of l3_0>
if(l3_0>0):
print l3_0
print auto_order_buy('0.01',str(ticker_last('btcusd')))
elif(l3_0<0):
print l3_0
print auto_order_sell('0.01',str(ticker_last('btcusd')))
else:
pass
now in my function l3_0>0 auto_order_buy() is executed but as program is running in while loop so it gets executed again and again. I have implemented while loop because I am doing live trading. is there any approach I can go with so auto_order_buy() auto_order_sell() function only executed once?
More information about the Python-list
mailing list