algomojo交易api的函数python包装器
algomojo的Python项目详细描述
关于
用于algomojo交易api的功能性python包装器。 Algomojo是一个用于Algomojo Free API + Free Algo Trading Platform 的python库。 它支持两个REST-API接口,可以方便地进行快速交易的算法开发。 在Reatime中执行订单、修改/取消订单、检索订单簿、交易簿、未平仓、平仓等功能。 有关每个API行为的更多详细信息,请参阅algomojoapi文档。在
许可证
Algomojo(c)2020年。根据麻省理工学院的许可证。在
文件
Algomojo Rest API documentation
安装
从PyPI安装
pip install Algomojo
或者,从源代码安装。执行设置.py从根目录。 python设置.py安装
当项目仍在alpha中时,请始终使用最新版本!在
使用示例
为了调用Algomojo trade API,您需要向其中一个合作伙伴代理注册一个交易帐户,并获得API密钥对,并且可以无限访问基于API的交易。 用从web控制台获得的内容替换api_密钥和api_密钥。在
入门
下载包后,导入包并使用api凭据创建对象
^{pr2}$正在创建对象
对于创建一个对象,有3个参数将被传递
api_key : str
User Api key (logon to algomojo account to find api credentials)
api_secret : str
User Api secret (logon to algomojo account to find api credentials)
Broker : str
This takes broker it generally consists 2 letters , EX: alice blue--> ab, tradejini-->tj, zebu-->zb
样品:
ab=algo.api(api_key="20323f062bb71ca6fbb178b4df8ac5z6",
api_secret="686786a302d7364d81badc233f1d22e3",
broker="ab")
使用对象方法
在目标方法(必需的参数)或目标方法(辅助参数+所需参数)
可行方法
1。下单:
Function with mandatory parmeters:
place_order(ticker,exchange,action,qty)
Function with all parametrs:
place_order(ticker,exchange,action,qty,order_type,price,discqty,trig_price,
product_type,strategy_name,api_key,api_secret)
Sample :
ab.place_order(ticker="RELIANCE-EQ",
exchange="NSE",
action="B",
qty=1)
2。取消订单:
Funtion with mandatory parameters:
cancelorder(client_id,nestordernumber,ticker,exchange)
Function with all parameters:
cancelorder(client_id,nestordernumber,ticker,exchange,api_key,api_secret)
Sample : ab.cancel_order(client_id='AB1234',
nestordernumber='201109000000025',
ticker="RELIANCE-EQ",
exchange="NSE")
3。修改顺序:
Funtion with mandatory parameters:
modify_order(client_id,nestordernumber,ticker,exchange,action,price_type,price,qty,symbol_token,filled_qty)
Function with all parameters:
modify_order(client_id,nestordernumber,ticker,exchange,action,price_type,price,qty,symbol_token,filled_qty,
product_type,disc_qty,trig_price,api_key,api_secret)
Sample :
ab.modify_order(client_id='AB1234',
nestordernumber='201109000000025',
ticker="RELIANCE-EQ",
exchange="NSE",
action="B",
order_type="L",
price="2000",
qty="2",
symbol_token="11184")
4。下订单:
Funtion with mandatory parameters:
place_option_order(spot_sym,expiry,opt_type,action,qty)
Function with all parameters:
place_option_order(spot_sym,expiry,opt_type,action,qty,order_type,product_type,price,trig_price,
strike_int,offset,strategy_name,api_key,api_secret)
Sample for tradejini: `
tj.place_option_order(spot_sym="NIFTY",
expiry="19NOV20",
opt_type="CE",
action="B",
qty="75")
Sample for aliceblue:
ab.place_option_order(spot_sym="NIFTY",
expiry="20N19",
opt_type="CE",
action="B",
qty="75")
5。下括号顺序:
Funtion with mandatory parameters:
place_bracket_order(token,exchange,action,qty,target,stoploss)
Function with all parameters:
place_bracket_order(token,exchange,action,qty,target,stoploss,trailingSL,tSLticks,price,trig_price,
discqty,SqrOffAbsOrticks,SLAbsOrticks,strategy_name,api_key,api_secret)
Sample:
ab.place_bracket_order(token="RELIANCE-EQ",
exchange="NSE",
action="B",
qty=0,
target=1,
stoploss=1)
6。取消公司:
Funtion with mandatory parameters:
cancel_co(self,client_id,nestordernumber)
Function with all parameters:
cancel_co(self,client_id,nestordernumber,api_key,api_secret)
Sample:
ab.cancel_co(client_id='AB1234',
nestordernumber='201109000000025')
7。取消操作:
Funtion with mandatory parameters:
cancel_bo(client_id,nestordernumber)
Function with all parameters:
cancel_bo(client_id,nestordernumber,status,api_key,api_secret)
Sample:
ab.cancel_bo(client_id='AB1234',
nestordernumber='201109000000025')
8。订单簿:
Funtion with mandatory parameters:
order_book(client_id)
Function with all parameters:
order_book(client_id,api_key,api_secret)
Sample:
ab.order_book(client_id='AB1234')
9。位置簿:
Funtion with mandatory parameters:
position_book(self,client_id)
Function with all parameters:
position_book(self,client_id,prod_type,api_key,api_secret)
Sample:
ab.position_book(client_id='AB1234')
10。订单历史:
Funtion with mandatory parameters:
order_history(client_id,nestordernumber)
Function with all parameters:
order_history(client_id,nestordernumber,api_key,api_secret)
Sample:
ab.order_history(client_id='AB1234',
nestordernumber='201109000000025')
11。下多个订单:
place_multi_order(order_list)
Sample order_list:
[{"ticker":"INFY-EQ","exchange":"NSE","action":"B","qty":"1"},
{"ticker":"BHEL-EQ","exchange":"NSE","action":"B","qty":"1"}]
Sample function call:
ab.place_multi_order(order_list)
12。地点:
place_multi_bo(order_list)
sample order list:
[{"ticker":"INFY-EQ","exchange":"NSE","action":"B","qty":"1","profit":"1","stoploss":"1"},
{"ticker":"BHEL-EQ","exchange":"NSE","action":"B","qty":"1","profit":"1","stoploss":"1"}]
Sample funcion call :
ab.place_multi_bo(order_list)
13. squareoff:
Funtion with mandatory parameters:
squareoff(client_id, ticker, symbol_token, qty)
Function with all parameters:
squareoff(client_id, ticker, symbol_token, qty, exchange_seg, product_type,api_key, api_secret)
Sample: ab.squareoff(client_id='AB1234',
ticker='BHEL-EQ',
symbol_token='438',
qty=1,
product_type=='MIS')
14。部分转换:
Funtion with mandatory parameters:
partial_convert(client_id, ticker, symbol_token, qty)
Function with all parameters:
partial_convert(client_id, ticker, symbol_token, qty, exchange_seg, product_type,api_key, api_secret)
Sample:
ab.partial_convert(client_id='AB1234',
ticker='BHEL-EQ',
symbol_token='438',
qty=1,
product_type=='MIS')
15。ltp U盖:
Funtion with mandatory parameters:
ltp_cover(symbol_token, exchange, action, api_key, api_secret)
Function with all parameters:
ltp_cover(symbol_token, exchange, action, api_key, api_secret)
Sample:
ab.ltp_cover(symbol_token='438',
exchange='NSE',
action='B')
16。符号信息
Funtion with mandatory parameters:
symbol_info(symbol)
Function with all parameters:
symbol_info(symbol, api_key, api_secret)
Sample:
ab.symbol_info(symbol="BHEL-EQ")
17。安全信息
Funtion with mandatory parameters:
security_info(security_dict)
Function with all parameters:
security_info(security_dict, api_key, api_secret)
Sample:
ab.security_info(security_dict={"uid":"AB1234","Exchange":"NSE","SrchFor":"438"})
18。限值:
^{pr21}$- 项目
标签: