-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
returnOrderTrades() maybe bug #151
Comments
I think i have trouble in my code i have modified something i tell you now if it s work keep in touch. |
polo also has some connection error and freezes. maybe your app doesnt
like it.
Op 3 aug. 2017 21:37 schreef "yepla" <[email protected]>:
… Hello,
I am using the v0.4.6 and there are a strange bug in my code or in
poloniex api or in the module ...
I have put an amount to buy then sell it
I check when the amount is buy before sell it
My bot is working well a lot of time but when i was wake up this morning i
have had the amount buy and no sell order set.
So i think maybe there are a bug in returnOrderTrades().
I use in a function returnOrderTrades to get the amount to sell but it
seems sometime it's not working.
Here my func:
def check(order_id):
global polo
global timeout
polo.timeout = (timeout, timeout)
while True:
try:
result = polo.returnOrderTrades(order_id)
total_end = Decimal("0")
amount_end = Decimal("0")
for item in result:
fee = Decimal(str(item["fee"]))
total_end += Decimal(str(item["total"]))
amount = Decimal(str(item["amount"]))
amount = amount * (Decimal("1") - fee)
amount = amount.quantize(Decimal('.00000001'), rounding=ROUND_FLOOR)
amount_end += amount
else:
return(1, amount_end, total_end)
except Exception as exc:
if str(exc) == "Order not found, or you are not the person who placed
it."):
return(0, Decimal("0"), Decimal("0")
Note i cancel the order before the check so if i have buy something check
return me (1, amount_end, total_end) if not (0, Decimal("0"), Decimal("0")
I have read all my code a lot of time and i found nothing wrong in it.
So i think there are a bug in the poloniex module for returnOrderTrades()
or in poloniex which return not the good value.
Thanks for your help.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#151>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AQ4TJswCBt2UdvIuLgz0w0-b9u7ZRcgqks5sUiGVgaJpZM4Os5Wb>
.
|
I don't think it was the problem all my api request are in a while True, so it s not stop the while until it get the result ! |
Personally, I have had issues with the First, I have found that calling returnOrderTrades on an open order (that you own), poloniex will return an error if that order has not made any trades yet (like a postOnly order).
Second, orderNumber = polo.buy(market, rate, amount, orderType='fillOrKill')['orderNumber']
trades = polo.returnOrderTrades(orderNumber) You would need to wait a bit: orderNumber = polo.buy(market, rate, amount, orderType='fillOrKill')['orderNumber']
time.sleep(2)
trades = polo.returnOrderTrades(orderNumber) This is probably an internal lag issue with poloniex and not much can be done but add a pause in the script. Third, poloniex now has a ban policy in which if a user makes too many api calls which returns an error in a short time, they will ban that users ip temporarily, resulting in cloudflare messages (invalid JSON).
Since |
I use returnOrderTrades dirrectly after cancel the order so does i need put a sleep between the cancel and returnOrderTrades ? |
I would hope 2 sec is enough time, but only poloniex knows. You shouldn't need to wait between every api call, just the ones that have data that needs to be processed by the poloniex servers. Like placing an order then checking for trades. Poloniex might be under heavy load and the market is moving quickly. If you send an api request to poloniex asking to place an order, it takes some time for poloniex to process the request. You are going to want to wait a bit before you ask for information on that order. How long? I have no idea, it probably changes when there are a lot of users online. 1-2 sec is probably safe but probably not needed between every api call. |
ok but does i need to put a sleep between a cancel order and a returnOrderTrades ? |
If it is on the same 'orderNumber', I probably would. |
and between a buy and a cancel ? |
again, if the same orderNumber, yes your going to want a slight pause. |
ok thanks |
I have also received the message you describe after placing an order. However, I just pause and then check again a moment later and it works for me. It seems to be as s4w3d0ff said, where Poloniex doesn't place the order immediately. |
Hello,
I am using the v0.4.6 and there are a strange bug in my code or in poloniex api or in the module ...
I have put an amount to buy then sell it
I check when the amount is buy before sell it
My bot is working well a lot of time but when i was wake up this morning i have had the amount buy and no sell order set.
So i think maybe there are a bug in returnOrderTrades().
I use in a function returnOrderTrades to get the amount to sell but it seems sometime it's not working.
Here my func:
def check(order_id):
global polo
global timeout
polo.timeout = (timeout, timeout)
while True:
try:
result = polo.returnOrderTrades(order_id)
total_end = Decimal("0")
amount_end = Decimal("0")
for item in result:
fee = Decimal(str(item["fee"]))
total_end += Decimal(str(item["total"]))
amount = Decimal(str(item["amount"]))
amount = amount * (Decimal("1") - fee)
amount = amount.quantize(Decimal('.00000001'), rounding=ROUND_FLOOR)
amount_end += amount
else:
return(1, amount_end, total_end)
except Exception as exc:
if str(exc) == "Order not found, or you are not the person who placed it."):
return(0, Decimal("0"), Decimal("0")
Note i cancel the order before the check so if i have buy something check return me (1, amount_end, total_end) if not (0, Decimal("0"), Decimal("0")
I have read all my code a lot of time and i found nothing wrong in it.
So i think there are a bug in the poloniex module for returnOrderTrades() or in poloniex which return not the good value.
And other question does i need to use the v0.4.6 or the last one from github ?
Thanks for your help.
The text was updated successfully, but these errors were encountered: