Skip to main content

A functional python wrapper for algomojo trading api

Project description

ABOUT

A functional python wrapper for algomojo trading api. Algomojo is a python library for the Algomojo Free API + Free Algo Trading Platform . It allows rapid trading algo development easily, with support for both REST-API interfaces. Execute Orders in Reatime, Modify/Cancel Orders, Retrieve Orderbook, Tradebook, Open Positions, Squareoff Positions and much more functionalities. For more details of each API behavior, Pease see the Algomojo API documentation.

License

Algomojo (c) 2020. Licensed under the MIT License.

Documentation

Algomojo Rest API documentation

Installation

Install from PyPI

pip install Algomojo

Alternatively, install from source. Execute setup.py from the root directory. python setup.py install

Always use the newest version while the project is still in alpha!

Usage Examples

In order to call Algomojo trade API, you need to sign up for an trading account with one of the partner broker and obtain API key pairs and enjoy unlimited access to the API based trading. Replace api_key and api_secret_key with what you get from the web console.

Getting Started

After downloading package import the package and create the object with api credentials

from algomojo import pyalgomojo as algo

Creating Object

For creating an object there are 3 arguments which would be passed

     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

Sample:

ab=algo.api(api_key="20323f062bb71ca6fbb178b4df8ac5z6",
	    api_secret="686786a302d7364d81badc233f1d22e3",
	    broker="ab")

Using Object Methods

obj.method(mandatory_parameters) or obj.method(madatory_parameters+required_parameters)

Avaliable Methods

1. place_order:

	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. cancel_order:

	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. modify_order:

	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. place_option_order:

	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. place_bracket_order:

	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. cancel_co:

	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. cancel_bo:

	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. order_book:

	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. postion_book:

	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. order_history:

	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:

	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 :

	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. partial_convert:

	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_cover:

	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. symbol_info

	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. security_info

	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. limits:

	Funtion with mandatory parameters:   
					     limits(client_id, segment, exchange, product_type)
	Function with all parameters:        
					     limits(client_id, segment, exchange, product_type, api_key, api_secret)
	Sample:                              
					      ab.limits(client_id='AB1234',
					      		exchange='NSE')

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for algomojo, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size algomojo-0.1-py3-none-any.whl (6.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size algomojo-0.1.tar.gz (5.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page