Giter VIP home page Giter VIP logo

sinalv2's Introduction

#软件使用 该软件需要自行购买新浪的level2标准版

在windows, linux, mac下都可以运行 支持python3.4+

安装

git clone https://github.com/flycandy/sinalv2
cd sinalv2
pip3 install -r requirements.txt
vim account.example.json # 修改account.example.json 为自己的用户名密码
python3 sinalv2.txt

新浪level2行情接口 说明

登陆新浪

不过新浪登陆后, 一个cookie能够使用很久. 所以, 就算不写自动登陆的脚本也是没有问题的, 可以从浏览器取得cookie, 然后存在文件里, 每次从文件里读取cookie即可

登陆脚本参考该页面 Reference https://gist.github.com/mrluanma/3621775

请求一个token

URL: 'https://current.sina.com.cn/auth/api/jsonp.php/varxxxl/AuthSign_Service.getSignCode' 方法: Post

字段 说明
query query_type
ip 当前机器的公网IP
list 请求的查看股票的列表
kick 1 就是把其余的请求踢掉, 0就是如果有其他地方登陆的话. 返回错误
|经过测试. 这里应该可以一直设置成1 有0这个选项. 是因为网页登陆level2行情的时候. 默认都只会发送0请求, 防止你同一个账户异地多浏览器登陆

使用token用websocket获取行情

获取token是一个websocket协议

ws://ff.sinajs.cn/wskt?token={token}&list={list}

token必须是使用该{list}得到的token. 不然会报错

token需要定时更新. 每一个websocket只会持续大概3-5分钟. 当websocket disconnect之后, 需要重新请求一个token. 然后再次链接websocket

sinalv2's People

Contributors

flycandy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.