Skip to content
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

404 error get_deals_and_orders(). #102

Closed
AmirEghbali opened this issue May 31, 2024 · 4 comments · Fixed by #105
Closed

404 error get_deals_and_orders(). #102

AmirEghbali opened this issue May 31, 2024 · 4 comments · Fixed by #105

Comments

@AmirEghbali
Copy link
Contributor

Lately this does not work. Apparently sometimes but I am getting more and more errors.

Any alternative to get current open orders?

@AmirEghbali
Copy link
Contributor Author

Does even this work?

**_ORDER_GET_PATH = '/_mobile/order/{}?accountId={}&orderId={}'_**

How to get details of ongoing order if we know the orderId?

@Unt3r
Copy link
Contributor

Unt3r commented Jun 12, 2024

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
    )

@AmirEghbali
Copy link
Contributor Author

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 :)

@Unt3r
Copy link
Contributor

Unt3r commented Jun 24, 2024

Ok.
I tried to make a pull request now.

@Qluxzz Qluxzz linked a pull request Jun 25, 2024 that will close this issue
Qluxzz pushed a commit that referenced this issue Jun 25, 2024
* Update constants.py

Added DEALS_PATH  and ORDERS_PATH

* Update avanza.py

Added get_deals(self) and get_orders(self)

* Update avanza.py

Removed get_deals_and_orders()
Fixed intendation

* Update constants.py

Removed DEALS_AND_ORDERS_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants