Saxo Plugin

Posted By: bdgogo

Saxo Plugin - 12/29/23 09:26

Hello, i am trying to get the Saxoplugin up and running on a saxo liveaccount. I created a App in Simulation an one in Live on Saxo Developer. I can run eg. the downloadscript with an 24 our token on the simulatuon account. If i use the live app with auth i get this Error.
Download
Login 0 Saxo V2..
!AppKey and Secret detected.
!Authorization required.
!Launching browser for Authentication...
!Waiting for user to log in to Saxo Bank via web browser...
!Listening on http://127.0.0.1:31022/
!Acquired AuthCode.
!Login successful
!Invalid access token?
Can't connect!

Any ideas what i am doing wrong? Thanks in advance . Best regards bdgogo
Posted By: bdgogo

Re: Saxo Plugin - 01/03/24 12:03

Nobody using this Plugin? Maybe you need additional Information. The Logon completes in the Webbrowser without any error. I go through the Saxo 2FA logon and the the browser says Logon ok, close this window.
But the saxo plugin then does not connect. Changing the loglevel don't bring more information and there is no plugin log. Any help is very appreciated. Thankx
Posted By: AndrewAMD

Re: Saxo Plugin - 01/03/24 12:24

Did you configure your Accounts.csv file correctly? Refer to the following:
https://zorro-project.com/manual/en/saxo.htm

Quote
If you have a permanent token, enter it in the User field, and keep the Password field empty.
If you have no token, enter the client id in the User field, and the secret in the password field.
Start the session. With no token, you will be redirected to a website where you enter your credentials.
Zorro will then automatically request a token and start trading.

User: Token or Client ID
Password: Empty or Secret

Example account list entries:
Code
Name,Server,AccountId,User,Pass,Assets,CCY,Real,NFA,Plugin
SaxoToken,Saxo,EUR,tokenabcdefg123456xyz,0,AssetsSaxo,USD,1,14,Saxo
SaxoAuth,Saxo,EUR,idijklmnop4711,00123456abcdef,AssetsSaxo,USD,1,14,Saxo
Posted By: bdgogo

Re: Saxo Plugin - 01/03/24 14:17

Thank you Andrew!
Yes, i think so because the plugin redirects me to the Saxo Loginsite and i can login there successfully. Here my Accountsentry. id and pw changed :-)
SaxoAuthlive,Saxo,EUR,ddbe1261cce1436b911cdb327xxxxxd,fed951bb100441ac9yyyyyyyabcb8888,AssetsSaxo,USD,1,14,Saxo

i also tried it with the SaxoToken entry and a 24h token. This works well but as far as i understand this works only with an simulation account and an permanent token is not possible for retail oder business accounts.
Posted By: bdgogo

Re: Saxo Plugin - 01/03/24 16:10

For the id and password in the accounts.csv i use the appid and the appsecret. In saxotrader log i see a successful application login.
I also updated the local saxotraderapp to the latest version on my Windows 11 PC
Posted By: AndrewAMD

Re: Saxo Plugin - 01/03/24 16:38

I found this in my notes regarding Saxo, so maybe the man page has bad info:
  • Username is AppKey, password is the Secret.
  • In the web portal where the app keys are stored, the URL redirect must specifically be set to “http://127.0.0.1:31022/”.
  • It will need to launch a web browser, where the user must enter account credentials. It will hand a code back to Zorro.
  • The refresh tokens expire after only one hour, so the user will need to log in every time they start Zorro.
  • The good news is that the refresh tokens get automatically updated while it is up.
  • The bad news is that if the servers go down for an hour, the user will need to log in to get it back up and running.
Posted By: bdgogo

Re: Saxo Plugin - 01/03/24 18:14

Hi Andrew, thank you for the list. This is exact what i have done. The redirect URL is also ok. As you can see in the attached screenshot.
Seems that it give back a code, but the plugin cannot interpret this. I have tried this also on a different Windows 11 pc and i am using Zorro S
Best regards Dirk

Attached picture Screenshot 2024-01-03 191038.png
Posted By: AndrewAMD

Re: Saxo Plugin - 01/03/24 18:39

Set the LOGFILE flag and set the Verbose global value to 7 + DIAG and upload the log files. If necessary censor sensitive data.
Posted By: bdgogo

Re: Saxo Plugin - 01/03/24 20:26

Sorry , with this code at the beginning of the script :
function run()
{
Verbose = 7+DIAG+LOGMSG;
if(is(INITRUN))
{
set(LOGFILE);

}
...

There is no Diagnosticlogfile when i run in Trademode only in Testmode. And the normal Logfile contains the same information as posted at the beginning of the thread. I also tried to set the verboseflag in zorrofix.ini but the same result.
Posted By: bdgogo

Re: Saxo Plugin - 01/04/24 11:17

Hi, back to my initial question. Is anybody using this plugin and does it work with enabled 2fa? tnx
Posted By: jcl

Re: Saxo Plugin - 01/04/24 16:32

The ...diag.txt file is also generated in trade mode. Maybe you have a different Verbose setting elsewhere? You can also start Zorro with the -DIAG comman line option, it has the same effect.
Posted By: AndrewAMD

Re: Saxo Plugin - 01/04/24 16:45

Originally Posted by jcl
The ...diag.txt file is also generated in trade mode. Maybe you have a different Verbose setting elsewhere? You can also start Zorro with the -DIAG comman line option, it has the same effect.
Come to think of it, can LOGFILE and Verbose be set in the script before the first BrokerLogin() call? If not, then the commandline method is required.
Posted By: bdgogo

Re: Saxo Plugin - 01/04/24 16:48

Thank you jcl for the hint with the commandline option..
Very strange, after the update to 260.0.2 and no other changes on my system it now logs in without any problem. Thank you for the fix!!
Posted By: AndrewAMD

Re: Saxo Plugin - 01/04/24 16:51

Originally Posted by bdgogo
Thank you jcl for the hint with the commandline option..
Very strange, after the update to 260.0.2 and no other changes on my system it now logs in without any problem. Thank you for the fix!!
Probably because there was a bugfix since your version.
Posted By: bdgogo

Re: Saxo Plugin - 01/04/24 17:13

Thank you for you help Andrew, i think you are right. Maybe there was a fix in this version or something on my system was fixed by the installation script.
© 2024 lite-C Forums