multiple issues in bleutrade fetch_open_orders
See original GitHub issue- OS: Windows
- Programming Language version: Python 3.6
- CCXT version: 671
- Exchange: Bleutrade
- Method: fetch_open_orders
Multiple KeyErrrors (OrderType, Closed, Timestamp, OrderUuid)
import ccxt.async as ccxt
import test2_config as config
import asyncio
from pprint import pprint
async def main():
exchange = 'bleutrade'
e = getattr(ccxt, exchange)()
e.verbose = True
e.apiKey = config.exchange_keys[exchange]['key']
e.secret = config.exchange_keys[exchange]['secret']
pprint(await e.fetch_open_orders())
# await e.cancel_order('83250721', 'ETH/BTC')
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
C:\Users\gaardiolor\Anaconda3\python.exe C:/Users/gaardiolor/PycharmProjects/test2/_test/test_bleutrade.py
https://bleutrade.com/api/v2/public/getmarkets GET https://bleutrade.com/api/v2/public/getmarkets
Request: {'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate'} None
GET https://bleutrade.com/api/v2/public/getmarkets
Response: {'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate'} {"success":"true","message":"","result":<sniplooksgood>
https://bleutrade.com/api/v2/public/getcurrencies GET https://bleutrade.com/api/v2/public/getcurrencies
Request: {'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate'} None
GET https://bleutrade.com/api/v2/public/getcurrencies
Response: {'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate'} {"success":"true","message":"","result":<sniplooksgood>
https://bleutrade.com/api/v2/market/getopenorders?nonce=1515843113&apikey=<snip> GET https://bleutrade.com/api/v2/market/getopenorders?nonce=1515843113&apikey=<snip>
Request: {'apisign': '<snip>', 'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate'} None
GET https://bleutrade.com/api/v2/market/getopenorders?nonce=<snip>&apikey=<snip>
Response: {'apisign': '<snip>', 'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate'} {"success":"true","message":"","result":[{"OrderId":"83250721","Exchange":"ETH_BTC","Type":"BUY","Quantity":"0.00100000","QuantityRemaining":"0.00100000","Price":"0.08000000","Status":"OPEN","Created":"2018-01-13 11:06:30","Comments":"","QuantityBaseTraded":"0.00000000"}]}
Traceback (most recent call last):
File "C:/Users/gaardiolor/PycharmProjects/test2/_test/test_bleutrade.py", line 18, in <module>
loop.run_until_complete(main())
File "C:\Users\gaardiolor\Anaconda3\lib\asyncio\base_events.py", line 467, in run_until_complete
return future.result()
File "C:/Users/gaardiolor/PycharmProjects/test2/_test/test_bleutrade.py", line 13, in main
pprint(await e.fetch_open_orders())
File "C:\Users\gaardiolor\Anaconda3\lib\site-packages\ccxt\async\bittrex.py", line 403, in fetch_open_orders
orders = self.parse_orders(response['result'], market, since, limit)
File "C:\Users\gaardiolor\Anaconda3\lib\site-packages\ccxt\base\exchange.py", line 949, in parse_orders
array = [self.parse_order(order, market) for order in array]
File "C:\Users\gaardiolor\Anaconda3\lib\site-packages\ccxt\base\exchange.py", line 949, in <listcomp>
array = [self.parse_order(order, market) for order in array]
File "C:\Users\gaardiolor\Anaconda3\lib\site-packages\ccxt\async\bittrex.py", line 447, in parse_order
if order['Closed']:
KeyError: 'Closed'
Process finished with exit code 1
Seems to work by copying parse_order from bittrex and modifying it:
def parse_order(self, order, market=None):
side = None
if 'Type' in order:
side = 'buy' if (order['Type'] == 'BUY') else 'sell'
status = 'open'
symbol = None
if not market:
if 'Exchange' in order:
if order['Exchange'] in self.markets_by_id:
market = self.markets_by_id[order['Exchange']]
if market:
symbol = market['symbol']
timestamp = None
if 'Opened' in order:
timestamp = self.parse8601(order['Opened'])
if 'Created' in order:
timestamp = self.parse8601(order['Created'])
fee = None
commission = None
if 'Commission' in order:
commission = 'Commission'
elif 'CommissionPaid' in order:
commission = 'CommissionPaid'
if commission:
fee = {
'cost': float(order[commission]),
'currency': market['quote'],
}
price = self.safe_float(order, 'Limit')
cost = self.safe_float(order, 'Price')
amount = self.safe_float(order, 'Quantity')
remaining = self.safe_float(order, 'QuantityRemaining', 0.0)
filled = amount - remaining
if not cost:
if price and amount:
cost = price * amount
if not price:
if cost and filled:
price = cost / filled
average = self.safe_float(order, 'PricePerUnit')
result = {
'info': order,
'id': order['OrderId'],
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': symbol,
'type': 'limit',
'side': side,
'price': price,
'cost': cost,
'average': average,
'amount': amount,
'filled': filled,
'remaining': remaining,
'status': status,
'fee': fee,
}
return result
diff:
$ diff bleutrade bittrex
2a3,4
> if 'OrderType' in order:
> side = 'buy' if (order['OrderType'] == 'LIMIT_BUY') else 'sell'
4c6
< side = 'buy' if (order['Type'] == 'BUY') else 'sell'
---
> side = 'buy' if (order['Type'] == 'LIMIT_BUY') else 'sell'
5a8,11
> if order['Closed']:
> status = 'closed'
> elif order['CancelInitiated']:
> status = 'canceled'
16,17c22,23
< if 'Created' in order:
< timestamp = self.parse8601(order['Created'])
---
> if 'TimeStamp' in order:
> timestamp = self.parse8601(order['TimeStamp'])
43c49
< 'id': order['OrderId'],
---
> 'id': order['OrderUuid'],
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
huobipro fetchOpenOrders: consider using different endpoints ...
Suggestion: Use v1/order/openOrders if symbol parameter is present. If not, there's a way to get open orders of all symbols using v1/order/ ...
Read more >BLEUTRADE Review 2022 - FX Empire
There seem to be issues with withdrawals in terms of excessive delays. Many purchases of altcoins are not completed at once, thus subjecting...
Read more >ccxt Documentation - Read the Docs
A JavaScript / Python / PHP library for cryptocurrency trading and e-commerce with support for many bit- coin/ether/altcoin exchange markets ...
Read more >Bleutrade Review 2022: Is It Reliable & Secure Exchange?
Bleutrade is an online cryptocurrency exchange where investors can trade cryptocurrencies. This blockchain-powered company has been ...
Read more >Error Messages, by Exakat
Message File Line
$this‑>id . ' allows limit orders only' /php/itbit.php 566
$this‑>id . ' returned ' . $this‑>json($response) /php/cex.php 1234
/php/cex.php 581
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes you’re right it works! Thanks 😃
@gaardiolor alright, looks like fixed completely now, can you retry again and report, please? Thx!