![]() |
|
[Python] How can I make this Python script add a limit to trades made with API? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] How can I make this Python script add a limit to trades made with API? (/showthread.php?tid=5894524) |
How can I make this Python script add a limit to trades made with API? - streetlawkarma - Oct 12, 2018 I'm putting together a python script to make trades on poloniex with the API, and so far I've got it to make trades when certain conditions are met, but I still need it to NOT place anymore trades for the rest of that day (I have the entire script looping every 60 seconds). So far I have this script: Code import requestsAnyway, after a trade has been placed, I need it to make sure that after the 60 second sleep, it doesn't make a second trade unless it is a new day/the day after the trade was made. (Could I use poloniex server time for this?) So, if it has got as far as print (ordernumber) that means it has placed a trade. But how do I mark it as placed trade for the day or something and use it in the if float(poloniexlastP) > 0: for the next loop to make sure it doesn't place another one? RE: How can I make this Python script add a limit to trades made with API? - m0noxide - Oct 12, 2018 There are a couple approaches to this, depending on where you want to get the information from 1. You could query the Poloniex API to get your order history (via the returnTradeHistory endpoint in their API), and check for the time difference 2. You store your own state, in the form of a file, or a simple DB like sqlite, and on startup, query the time difference for your last order 3. Etc.. |