Closed AmirEghbali closed 3 months ago
Does even this work?
**_ORDER_GET_PATH = '/_mobile/order/{}?accountId={}&orderId={}'_**
How to get details of ongoing order if we know the orderId?
It looks like the deals and orders are gone.
I found two new links. One for deals and one for orders. After adding the following new methods it kind of works. Instead of calling get_deals_and_orders() you either call get_deals() or get_orders()
Anyone with skill please make needed changes for the api.
constants.py DEALS_PATH = '/_api/trading/rest/deals' ORDERS_PATH = '/_api/trading/rest/orders'
avanza.py
def get_deals(self):
""" Get currently active deals
Returns:
"deals":[
{
"id":str,
"account": {
"accountId": str,
"name": { "value": str },
"type": { "accountType": str },
"urlParameterId": str"
},
"orderbookId": str,
"volume": int,
"price": float,
"amount":float,
"time": str,
"side": str,
"orderId": str,
"orderbook": {
"id": str,
"name": str,
"countryCode": str,
"currency": str,
"instrumentType": str,
"volumeFactor": str,
"isin": str,
"mic": str
}
}
]
,"fundDeals":[]}
"""
return self.__call(
HttpMethod.GET,
Route.DEALS_PATH.value
)
def get_orders(self):
""" Get currently active orders
Returns:
"deals":[
{
"orders":[
{
"account":
{
"accountId":str,
"name":{
"value": str
},
"type":{"accountType": str},
"urlParameterId": str
},
"orderId": str,
"volume": int,
"price": float,
"amount" float,
"orderbookId": str,
"side": str,
"validUntil": str,
"created": str,
"deletable": bool,
"modifiable": bool,
"message": str,
"state": str,
"stateText": str,
"stateMessage": str,
"orderbook":{"id":str,"name":str,"countryCode":str,"currency":str,"instrumentType": str,"volumeFactor":str,"isin":str,"mic": str},
"additionalParameters":{}
}
]
,"fundDeals":[]}
"""
return self.__call(
HttpMethod.GET,
Route.ORDERS_PATH.value
)
It looks like the deals and orders are gone.
I found two new links. One for deals and one for orders. After adding the following new methods it kind of works. Instead of calling get_deals_and_orders() you either call get_deals() or get_orders()
Anyone with skill please make needed changes for the api.
constants.py DEALS_PATH = '/_api/trading/rest/deals' ORDERS_PATH = '/_api/trading/rest/orders'
avanza.py def get_deals(self): """ Get currently active deals Returns:
"deals":[ { "id":str, "account": { "accountId": str, "name": { "value": str }, "type": { "accountType": str }, "urlParameterId": str" }, "orderbookId": str, "volume": int, "price": float, "amount":float, "time": str, "side": str, "orderId": str, "orderbook": { "id": str, "name": str, "countryCode": str, "currency": str, "instrumentType": str, "volumeFactor": str, "isin": str, "mic": str } } ] ,"fundDeals":[]} """ return self.__call( HttpMethod.GET, Route.DEALS_PATH.value ) def get_orders(self): """ Get currently active orders Returns: "deals":[ { "orders":[ { "account": { "accountId":str, "name":{ "value": str }, "type":{"accountType": str}, "urlParameterId": str }, "orderId": str, "volume": int, "price": float, "amount" float, "orderbookId": str, "side": str, "validUntil": str, "created": str, "deletable": bool, "modifiable": bool, "message": str, "state": str, "stateText": str, "stateMessage": str, "orderbook":{"id":str,"name":str,"countryCode":str,"currency":str,"instrumentType": str,"volumeFactor":str,"isin":str,"mic": str}, "additionalParameters":{} } ] ,"fundDeals":[]} """ return self.__call( HttpMethod.GET, Route.ORDERS_PATH.value )
Great job! I tested these and they work.
If you managed to fix these I think you are skilled enough! Just add the changes to constants.py and avanza.py. Then make a pull request :)
Ok. I tried to make a pull request now.
Lately this does not work. Apparently sometimes but I am getting more and more errors.
Any alternative to get current open orders?