priv.api... och pub.api.test.nordnet.se

Added by Ulf over 5 years ago

Kan någon förklara när och hur priv.api.... och pub.api.test.nordnet.se skall användas.
Jag kan logga in med api.test.nordnet.se och får session_key ( r=requests.post(URL1 + '/login',data=params, headers=headers) )
Sen kan jag köra lite olika kommandon som accounts, lists, ...
Men hur skall jag använda pub. och priv.?
Skall jag logga in en gång till?? (Går inte)?
Programmerar i Python med tacksam för alla hjälp oavsett språk.


Replies (6)

RE: priv.api... och pub.api.test.nordnet.se - Added by Asbjørn over 5 years ago

Hello Ulf,

The feeds are your sources of real-time information, while the REST API is merely intended for information that is less time-sensitive. They are dual TCP sockets on which you can send information about what items you want to know about, and receive said information when they have changed. In the documentation it is described as 'submitting' to updates about items.

The public feed is used for information about stocks, their values and sales. The private feed is used for information about your own personal orders and trades.

Personally, I code in Perl, so I can't share any Python code with you. The documentation [1] is pretty thorough and detailed. You don't need to sign in again, you use the session key from the login to the REST API. It really boils down to sending a JSON frame with your session key, and then subscribing to information with some different JSON frames.

I hope that clears it up a bit.

- Asbjørn

[1] https://api.test.nordnet.se/next/2/api-docs/docs/feeds

RE: priv.api... och pub.api.test.nordnet.se - Added by Ulf over 5 years ago

Tack nu fungerar det. Vill bara kontrollera att jag förstått.
Jag öppnar socket till public feed och frågar tex. om pris på ERIC. Sedan lyssnar jag. Eftersom det är låg aktivitet in test systemet så får jag ett svar och sedan bara en massa heartbreaks. Kurserna i testsystemet är inte kopplade till riktiga kurser utan beror på att man lägger order i testsystemet? Priset för ERIK ändrades inte under den halvtimme som jag testade. Är detta riktigt?

Ulf

Utskrift från loopen nedan,

Public feed: pub.api.test.nordnet.se , port: 443
ERIC, i=100 m=11 last=107.5
heartbeat
heartbeat
heartbeat
...
...

print('Public feed:',hostPub,', port:',portPub)
  1. Ask price for ERIC ID=100
    cmd={"cmd":"subscribe", "args":{"t":"price", "i":"100", "m":11}}
    cmdj=str.encode(json.dumps(cmd) + "\n")
    ssl_socket.write(cmdj)
n=0
while n<100:
out=ssl_socket.read(1024)
outs=out.decode(encoding='UTF-8')
j = json.loads(outs)
d=j['data']
if d=={}:
print(j['type'])
else:
print('ERIC, i={} m={} last={}'.format(d['i'],d['m'],d['last']))
n+=1

RE: priv.api... och pub.api.test.nordnet.se - Added by Ulf over 5 years ago

hmm. koden blev lite konstig
Bifogar fil med koden

RE: priv.api... och pub.api.test.nordnet.se - Added by Ulf over 5 years ago

Nyt försök

@print('Public feed:',hostPub,', port:',portPub)
  1. Ask price for ERIC
    cmd={"cmd":"subscribe", "args":{"t":"price", "i":"100", "m":11}}
    cmdj=str.encode(json.dumps(cmd) + "\n")
    ssl_socket.write(cmdj)

n=0
while n<100:
out=ssl_socket.read(1024)
outs=out.decode(encoding='UTF-8')
j = json.loads(outs)
d=j['data']
if d=={}:
print(j['type'])
else:
print('ERIC, i={} m={} last={}'.format(d['i'],d['m'],d['last']))
n+=1

  1. Close socket
    del ssl_socket
    s.close()
    @

RE: priv.api... och pub.api.test.nordnet.se - Added by Ulf over 5 years ago

Sista försöket med fil igen

RE: priv.api... och pub.api.test.nordnet.se - Added by sunh 17 days ago

Your mind to share good information 먹튀검증 is great. Thank you for 먹튀검증 the future, I will visit frequently to see materials related to 스포츠중계 and 꽁머니. There are a lot of materials related 안전놀이터 and 토토사이트 on my site.There are also materials related to 안전놀이터 먹튀검증사이트 yours메이저토토사이트. 메이저안전놀이터 the best. I hope there will be many exchanges in the future.If you have time, please visit our site! My site name is 꽁머니 along with 안전놀이터, our site 토토사이트 also has the same information. We ask for your interest in our site as well. This was the above 먹튀검증 time I have a new site about 안전사설토토사이트 have a new site. It was created for a completely new 먹튀검증커뮤니티, so if you want to check out what's new, please visit 공식안전놀이터
가장확실한먹튀검증커뮤니티 .com Your post really helped me a lot. 먹튀검증 As an opportunity to 먹튀신고 read one article, 먹튀 I'm reading all your other posts. 먹튀검증업체 I found out 먹튀커뮤니티 that you are a person 먹튀사이트검증 with a lot of abilities. 먹튀사이트 Your website is 메이저놀이터 full of really needed content. 메이저안전놀이터추천 I envy you. 메이저놀이터추천 I also run one of my websites. 메이저놀이터 It's a little different from you, 사설토토 but many posts are registered on 메이저사설토토 my site, 사설토토사이트추천 and I'm still writing them. 사설토토사이트 The posts are being updated 사설놀이터 almost every week, 안전놀이터 so if you're interested, 토토안전놀이터 visit them and read them. 안전놀이터 I'm sure it'll help you, too. 토토사이트 There are many problems happening all over the world these days, 토토추천 and I hope you don't have any problems, 메이저토토사이트 and I hope you have a great day today. 먹튀없는토토사이트 Thank you again for letting me read this, 토토사이트추천 and I'll see you next time. 토토사이트 Good bye

(1-6/6)