Python SDK for 5paisa APIs natively written in VB.NET
Project description
5paisa Python SDK
Python SDK for 5paisa APIs natively written in VB .NET
Documentation
Read the docs hosted here
Features
- Order placement, modification and cancellation
- Fetching user info including holdings, positions, margin and order book.
- Fetching order status and trade information.
Usage
Configuring API keys
Get your API keys from https://www.5paisa.com/developerapi/apikeys
Configure these keys in a file named keys.conf
in the same directory as your python script exists
A sample keys.conf
is given below:
[KEYS]
APP_NAME=YOUR_APP_NAME_HERE
APP_SOURCE=YOUR_APP_SOURCE_HERE
USER_ID=YOUR_USER_ID_HERE
PASSWORD=YOUR_PASSWORD_HERE
USER_KEY=YOUR_USER_KEY_HERE
ENCRYPTION_KEY=YOUR_ENCRYPTION_KEY_HERE
Authentication
from py5paisa import FivePaisaClient
client = FivePaisaClient(email="random_email@xyz.com", passwd="password", dob="YYYYMMDD")
client.login()
After successful authentication, you should get a Logged in!!
message
Fetching user info
# Fetches holdings
client.holdings()
# Fetches margin
client.margin()
# Fetches positions
client.positions()
# Fetches the order book of the client
client.order_book()
Placing an order
# Note: This is an indicative order.
from py5paisa.order import Order, OrderType, Exchange, ExchangeType
test_order = Order(order_type=OrderType.BUY, scrip_code=11111, quantity=10)
client.place_order(test_order)
Modifying an order
client.modify_order(exch_order_id="12345678", traded_qty=10, scrip_code=11111)
Canceling an order
client.cancel_order(exch_order_id="12345678", traded_qty=10, scrip_code=11111)
Fetching Order Status and Trade Information
from py5paisa.order import OrderForStatus, Exchange, ExchangeType, RequestList
test_order_status = OrderForStatus(exchange=Exchange.BSE, exchange_type=ExchangeType.CASH, scrip_code=500875, order_id=0)
req_list = RequestList()
# Add multiple orders to the RequestList to know status of multiple orders at once.
req_list.add_order(test_order_status)
# Fetches the trade details
client.fetch_trade_info(req_list)
# Fetches the order status
client.fetch_order_status(req_list)
TODO
- Write tests.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py5paisa-0.1.5.tar.gz
(55.8 kB
view hashes)
Built Distribution
Close
Hashes for py5paisa-0.1.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0c8a65478cb70dd270efade97756c860ec81b3c8022c74e71c5faa525786f92 |
|
MD5 | b38f828981d6d2410e0ce701d6084249 |
|
BLAKE2b-256 | d9613bae41b000cd2654403e0f467ce4e377ccf555107326cc34507538ba4f7e |