Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 652 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 4 1 2 3 4
Re: AlpacaZorroPlugin v1.0.6 Released [Re: Lapsa] #484158
09/17/21 03:16
09/17/21 03:16
Joined: Sep 2019
Posts: 63
Naperville
K
kzhao Offline OP
Junior Member
kzhao  Offline OP
Junior Member
K

Joined: Sep 2019
Posts: 63
Naperville
@Lapsa Sorry, for my poor English. I will go over the README and fix typos. Feel free to create a pull request or an issue in Github. Thanks

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484159
09/17/21 03:31
09/17/21 03:31
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @kzhao.

OK, after (lots) more testing:

- The plugin seems to always fail login on the 1st try with "access key not found"
- Rerunning the script without changing anything login succeeds.
- But the generate fails and a Zorro Alert pops up that says "BrokerCommand 2001 61868921 at <time>". After this the file remains locked by Zorro/plugin (Notepad won't open it) even though the script is no longer running.
- A 3rd run gives the "Failed to open" message as above.
- If I delete the file and run the script again (4th try), it starts to finally work (yay!)
- I used your assets above, and PH works, but the other 3 all report "!forbidden." and do not appear in the file
- (Minor bug) As in your example above, PH is followed by a period (.), whereas none of the other assets is

Next step?

Thanks!

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484160
09/17/21 03:45
09/17/21 03:45
Joined: Sep 2019
Posts: 63
Naperville
K
kzhao Offline OP
Junior Member
kzhao  Offline OP
Junior Member
K

Joined: Sep 2019
Posts: 63
Naperville
@DdlV

For the Download script, change LogLevel=6 do you see any errors? What is the response from Alpaca?

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484161
09/17/21 03:48
09/17/21 03:48
Joined: Sep 2019
Posts: 63
Naperville
K
kzhao Offline OP
Junior Member
kzhao  Offline OP
Junior Member
K

Joined: Sep 2019
Posts: 63
Naperville
@DdlV Which version of Zorro do you use? It seems an exception occurred and the file is not closed.

Last edited by kzhao; 09/17/21 03:50.
Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484162
09/17/21 03:59
09/17/21 03:59
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
@kzhao:

With LogLevel=6, tried Download SPY and got many lines like

Code
2021-09-17 03:51:55 | DEBUG | BorkerHisotry SPY start: 1609459200 end: 1631850714 nTickMinutes: 1 nTicks: 300
2021-09-17 03:51:55 | INFO | Alpaca Basic Plan. Adjust end to 1631849815
2021-09-17 03:51:55 | DEBUG | BorkerHisotry SPY start: 2021-01-01T00:00:00Z(1609459200) end: 2021-09-17T03:36:55Z(1631849815) nTickMinutes: 1 nTicks: 300


After a while the INFO lines stop and only the DEBUG lines show. No SPY file created.

Zorro version is 1.96.

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484165
09/17/21 13:36
09/17/21 13:36
Joined: Sep 2019
Posts: 63
Naperville
K
kzhao Offline OP
Junior Member
kzhao  Offline OP
Junior Member
K

Joined: Sep 2019
Posts: 63
Naperville
@ DdlV

1.96 might be too old. Could you try Zorro 2.35 and above?

For those symbols which returned "!forbidden", could you try

Code
curl -X GET \
    -H "APCA-API-KEY-ID: <YOUR_ALPACA_KEY>" \
    -H "APCA-API-SECRET-KEY:<YOUR_ALPACA_SECRETE>"\
    https://data.alpaca.markets/v2/stocks/SO/snapshot


SO is one of them, replace it with other symbols if you want to. What is the response from Alpaca?

BTW, the "." after the PH is not a bug. It was added by Zorro for indicating the progress of the operation.

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484166
09/17/21 14:25
09/17/21 14:25
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @kzhao.

I don't have curl installed, but using wget the test works - a snapshot file containing data is created

Since the first asset (PH) did not return an error, I tried putting a different asset first. The first asset again did not return an error, but all the others returned "forbidden", as before. So, something goes wrong in the processing of the 1st asset.

The LogLevel=6 shows the first asset's data is in fact returned, but I looked a little closer and see that no PH file was created, indicating an error occurs that is not being reported.

It will take a while longer to download, install, and try 2.35 or 2.40...

Thanks.

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484167
09/17/21 15:36
09/17/21 15:36
Joined: Sep 2019
Posts: 63
Naperville
K
kzhao Offline OP
Junior Member
kzhao  Offline OP
Junior Member
K

Joined: Sep 2019
Posts: 63
Naperville
@DdlV

To be clear, "no PH file was created" - you mean the PH is not written to the AssetsAlpaca.csv file or you are talking about the Download script did not create the PH history file?

When I run the GenAssetList script, I got the following in the Alpaca log:
Quote

2021-09-17 15:23:57 | DEBUG | --> https://data.alpaca.markets/v2/stocks/AEP/snapshot
2021-09-17 15:23:57 | TRACE2 | <-- {"symbol":"AEP","latestTrade":{"t":"2021-09-17T15:23:58.113971199Z","x":"U","p":84.94,"s":100,"c":["@","F"],"i":928,"z":"C"},"latestQuote":{"t":"2021-09-17T15:23:58.114431539Z","ax":"Q","ap":84.95,"as":2,"bx":"U","bp":84.94,"bs":1,"c":["R"],"z":"C"},"minuteBar":{"t":"2021-09-17T15:22:00Z","o":84.9581,"h":84.97,"l":84.9581,"c":84.9675,"v":2211,"n":56,"vw":84.964057},"dailyBar":{"t":"2021-09-17T04:00:00Z","o":85.98,"h":86.13,"l":84.92,"c":84.9675,"v":2132757,"n":15223,"vw":85.736417},"prevDailyBar":{"t":"2021-09-16T04:00:00Z","o":87.04,"h":87.605,"l":85.8,"c":85.98,"v":3648954,"n":48814,"vw":86.274489}}
2021-09-17 15:23:57 | DEBUG | --> https://data.alpaca.markets/v2/stocks/BRX/snapshot
2021-09-17 15:23:57 | TRACE2 | <-- {"symbol":"BRX","latestTrade":{"t":"2021-09-17T15:23:38.693Z","x":"D","p":23.635,"s":300,"c":[" "],"i":79372106414168,"z":"A"},"latestQuote":{"t":"2021-09-17T15:23:58.11787264Z","ax":"N","ap":23.64,"as":7,"bx":"K","bp":23.63,"bs":7,"c":["R"],"z":"A"},"minuteBar":{"t":"2021-09-17T15:22:00Z","o":23.635,"h":23.635,"l":23.63,"c":23.635,"v":1157,"n":14,"vw":23.634632},"dailyBar":{"t":"2021-09-17T04:00:00Z","o":23.7,"h":23.79,"l":23.5,"c":23.635,"v":606627,"n":3250,"vw":23.623893},"prevDailyBar":{"t":"2021-09-16T04:00:00Z","o":23.48,"h":23.81,"l":23.38,"c":23.63,"v":1916339,"n":11894,"vw":23.632988}}
2021-09-17 15:23:57 | DEBUG | --> https://data.alpaca.markets/v2/stocks/CFG/snapshot
2021-09-17 15:23:58 | TRACE2 | <-- {"symbol":"CFG","latestTrade":{"t":"2021-09-17T15:23:57.385924747Z","x":"H","p":44.07,"s":100,"c":[" ","F"],"i":52984217424189,"z":"A"},"latestQuote":{"t":"2021-09-17T15:23:58.123406848Z","ax":"N","ap":44.07,"as":11,"bx":"N","bp":44.06,"bs":3,"c":["R"],"z":"A"},"minuteBar":{"t":"2021-09-17T15:22:00Z","o":44.0802,"h":44.1,"l":44.07,"c":44.08,"v":26951,"n":96,"vw":44.079047},"dailyBar":{"t":"2021-09-17T04:00:00Z","o":43.55,"h":44.2401,"l":43.53,"c":44.08,"v":1364132,"n":10455,"vw":43.815531},"prevDailyBar":{"t":"2021-09-16T04:00:00Z","o":44.03,"h":44.3,"l":43.6,"c":43.72,"v":4073907,"n":34659,"vw":43.878355}}
2021-09-17 15:23:58 | DEBUG | --> https://data.alpaca.markets/v2/stocks/CMS/snapshot
2021-09-17 15:23:58 | TRACE2 | <-- {"symbol":"CMS","latestTrade":{"t":"2021-09-17T15:23:54.435002624Z","x":"N","p":62.28,"s":100,"c":[" "],"i":52983542271799,"z":"A"},"latestQuote":{"t":"2021-09-17T15:23:55.46624155Z","ax":"T","ap":62.29,"as":1,"bx":"N","bp":62.27,"bs":3,"c":["R"],"z":"A"},"minuteBar":{"t":"2021-09-17T15:22:00Z","o":62.3,"h":62.3153,"l":62.3,"c":62.3153,"v":1156,"n":33,"vw":62.305444},"dailyBar":{"t":"2021-09-17T04:00:00Z","o":62.33,"h":62.62,"l":62.11,"c":62.3153,"v":874822,"n":4409,"vw":62.339674},"prevDailyBar":{"t":"2021-09-16T04:00:00Z","o":62.8,"h":63.18,"l":62.39,"c":62.48,"v":1240504,"n":13493,"vw":62.627855}}
2021-09-17 15:23:58 | DEBUG | --> https://data.alpaca.markets/v2/stocks/CUBE/snapshot
2021-09-17 15:23:58 | TRACE2 | <-- {"symbol":"CUBE","latestTrade":{"t":"2021-09-17T15:23:59.423Z","x":"D","p":52.27,"s":300,"c":[" "],"i":71679970988629,"z":"A"},"latestQuote":{"t":"2021-09-17T15:23:59.474206848Z","ax":"N","ap":52.29,"as":3,"bx":"T","bp":52.27,"bs":1,"c":["R"],"z":"A"},"minuteBar":{"t":"2021-09-17T15:22:00Z","o":52.31,"h":52.33,"l":52.3,"c":52.33,"v":3511,"n":60,"vw":52.308776},"dailyBar":{"t":"2021-09-17T04:00:00Z","o":52.67,"h":52.78,"l":52.14,"c":52.33,"v":190342,"n":2107,"vw":52.483831},"prevDailyBar":{"t":"2021-09-16T04:00:00Z","o":52.81,"h":53.04,"l":52.41,"c":52.58,"v":635574,"n":8179,"vw":52.604212}}
2021-09-17 15:23:58 | DEBUG | close file


Do you see "!forbidden" in the log? Do all other assets, except the first, send a snapshot request and get a response?

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484168
09/17/21 16:28
09/17/21 16:28
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
@kzhao:

Sorry for the confusion! You're right - I have been mixing things...

GenAssetList: Using "brokerCommand(2001, "PH, SO, SUI, WEC");":

- AssetsAlpaca.csv contains only a PH row
- Log contains:
Code
2021-09-17 16:16:55 | DEBUG | --> https://data.alpaca.markets/v2/stocks/PH/snapshot
2021-09-17 16:16:57 | TRACE2 | <-- {"symbol":"PH","latestTrade":{"t":"2021-09-17T16:15:52.08019227Z","x":"V","p":287.6,"s":100,"c":[" "],"i":54333202192483,"z":"A"},"latestQuote":{"t":"2021-09-17T16:16:42.976071272Z","ax":"V","ap":0,"as":0,"bx":"V","bp":0,"bs":0,"c":["R"],"z":"A"},"minuteBar":{"t":"2021-09-17T16:15:00Z","o":287.58,"h":287.6,"l":287.58,"c":287.6,"v":244,"n":7,"vw":287.587295},"dailyBar":{"t":"2021-09-17T04:00:00Z","o":293.855,"h":293.855,"l":285.27,"c":287.6,"v":23473,"n":749,"vw":287.506828},"prevDailyBar":{"t":"2021-09-16T04:00:00Z","o":289.37,"h":291.375,"l":287.26,"c":289.71,"v":74303,"n":1079,"vw":289.392517}}
2021-09-17 16:16:57 | DEBUG | --> https://data.alpaca.markets/v2/stocks/ SO/snapshot
2021-09-17 16:16:58 | TRACE2 | <-- {"message": "forbidden."}

2021-09-17 16:16:58 | DEBUG | --> https://data.alpaca.markets/v2/stocks/ SUI/snapshot
2021-09-17 16:16:59 | TRACE2 | <-- {"message": "forbidden."}

2021-09-17 16:16:59 | DEBUG | --> https://data.alpaca.markets/v2/stocks/ WEC/snapshot
2021-09-17 16:17:01 | TRACE2 | <-- {"message": "forbidden."}

2021-09-17 16:17:01 | DEBUG | close file


Download: Entering PH and 2021:

- No PH file is created
- Log contains:
Code
2021-09-17 16:12:50 | DEBUG | --> https://data.alpaca.markets/v2/stocks/PH/snapshot
2021-09-17 16:12:51 | TRACE2 | <-- {"symbol":"PH","latestTrade":{"t":"2021-09-17T16:12:44.106958939Z","x":"V","p":288.02,"s":100,"c":[" "],"i":54328437011028,"z":"A"},"latestQuote":{"t":"2021-09-17T16:12:40.09506449Z","ax":"V","ap":0,"as":0,"bx":"V","bp":0,"bs":0,"c":["R"],"z":"A"},"minuteBar":{"t":"2021-09-17T16:08:00Z","o":287.85,"h":287.85,"l":287.84,"c":287.84,"v":237,"n":9,"vw":287.849916},"dailyBar":{"t":"2021-09-17T04:00:00Z","o":293.855,"h":293.855,"l":285.27,"c":287.84,"v":22757,"n":721,"vw":287.49602},"prevDailyBar":{"t":"2021-09-16T04:00:00Z","o":289.37,"h":291.375,"l":287.26,"c":289.71,"v":74303,"n":1079,"vw":289.392517}}
2021-09-17 16:12:51 | DEBUG | BorkerHisotry PH start: 1609459200 end: 1631895171 nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:51 | INFO | Alpaca Basic Plan. Adjust end to 1631894271
2021-09-17 16:12:51 | DEBUG | BorkerHisotry PH start: 2021-01-01T00:00:00Z(1609459200) end: 2021-09-17T15:57:51Z(1631894271) nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:51 | DEBUG | --> https://data.alpaca.markets/v2/stocks/PH/bars?start=2021-01-01T00:00:00Z&end=2021-09-17T15:57:51Z&limit=5000&timeframe=1D
2021-09-17 16:12:53 | TRACE2 | <-- {"message": "forbidden."}

2021-09-17 16:12:53 | DEBUG | BorkerHisotry PH start: 1609459200 end: 1631808771 nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:53 | DEBUG | BorkerHisotry PH start: 2021-01-01T00:00:00Z(1609459200) end: 2021-09-16T16:12:51Z(1631808771) nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:53 | DEBUG | --> https://data.alpaca.markets/v2/stocks/PH/bars?start=2021-01-01T00:00:00Z&end=2021-09-16T16:12:51Z&limit=5000&timeframe=1D
2021-09-17 16:12:54 | TRACE2 | <-- {"message": "forbidden."}

2021-09-17 16:12:54 | DEBUG | BorkerHisotry PH start: 1609459200 end: 1631722371 nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:54 | DEBUG | BorkerHisotry PH start: 2021-01-01T00:00:00Z(1609459200) end: 2021-09-15T16:12:51Z(1631722371) nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:54 | DEBUG | --> https://data.alpaca.markets/v2/stocks/PH/bars?start=2021-01-01T00:00:00Z&end=2021-09-15T16:12:51Z&limit=5000&timeframe=1D
2021-09-17 16:12:56 | TRACE2 | <-- {"message": "forbidden."}

2021-09-17 16:12:56 | DEBUG | BorkerHisotry PH start: 1609459200 end: 1631635971 nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:56 | DEBUG | BorkerHisotry PH start: 2021-01-01T00:00:00Z(1609459200) end: 2021-09-14T16:12:51Z(1631635971) nTickMinutes: 1440 nTicks: 1000
2021-09-17 16:12:56 | DEBUG | --> https://data.alpaca.markets/v2/stocks/PH/bars?start=2021-01-01T00:00:00Z&end=2021-09-14T16:12:51Z&limit=5000&timeframe=1D
2021-09-17 16:12:57 | TRACE2 | <-- {"message": "forbidden."}


Note: In this case there is no "close file" in the log.

Hope that is clearer.

Thanks.

Re: AlpacaZorroPlugin v1.0.6 Released [Re: kzhao] #484169
09/17/21 16:50
09/17/21 16:50
Joined: Sep 2019
Posts: 63
Naperville
K
kzhao Offline OP
Junior Member
kzhao  Offline OP
Junior Member
K

Joined: Sep 2019
Posts: 63
Naperville
@DdlV

In the Order and Position API, {"message": "forbidden."} implies that you don't have permission. I don't know why Alpaca returns the "forbidden" on the MarketData endpoint. It might be related to your account. I posted a question on Alpaca's dev-all Slack channel. If you use a Paper account, try to reset your account to see if that helps.

Page 2 of 4 1 2 3 4

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1