Skip to main content

shoonya

Unofficial Trading APIs for Finvasia Shoonya Web Platform.

Finvasia offers Zero Brokerage trading and is doing good recently with it's new Shoonya platform.
Please check shoonya web platform.
Open account with Finvasia

WORK IS STILL IN PROGRESS

USE AT YOUR OWN RISK

Installation

  • Python version >3.9 is needed for this module to work
  • Git is required for below command to work
  • pip install git+https://gitlab.com/algo2t/shoonya.git

Alternate way

  • Download the .whl file from releases section
  • Using pip to install => python -m pip install shoonya-0.1.0-py3-none-any.whl

How to setup a good environment

  • Install latest Python version 3.9.x, download it from here
  • Linux comes with python upgrade it to latest version 3.9.x
  • Use scoop for Windows as package manager.
  • Use your favorite editor like VSCodium or VSCode download it from here
  • VScode is available for Windows, Linux and Mac
  • Python extension for vscode is here
  • MagicPython is also good extension
  • Wonderful documentation for working with python and vscode is here
  • Use virtualenv to create a virtual python env so that your system is not affected
  • Steps for virtualenv creation - python -m pip install virtualenv and then virtualenv venv
  • Activate the venv => .\venv\Scripts\activate (this is an example for Windows OS)
  • Install and upgrade modules (venv) PS D:\trading\algo2trade\shoonya> python -m pip install -U pip wheel setuptools pylint rope autopep8

Usage

# Check config.py example FIRST

from config import username, password, panno

from shoonya import Shoonya

access_params = Shoonya.login_and_get_authorizations(username=username, password=password, panno=panno)

print(access_params)
with open('params.json', 'w') as wrl:
    json.dump(access_params, wrl)

config.py example

username='FA12345'
password='FinvAsia@P123'
panno='ABCDE1234Z'

Usage existing params.json

import json
from config import username, password, panno

from shoonya import Shoonya, TransactionType, ProductType, OrderType, InstrumentType


# NOTE: The params.json is created using the above login example

ACCESS_FILE = f'params.json'
with open(ACCESS_FILE, "r") as access:
    credentials = json.load(access)
    access_token = credentials["access_token"]
    key = credentials['key']
    token = credentials["token_id"]
    username = credentials['user_id']
    usercode = credentials["usercode"]
    usertype = credentials["usertype"]
    panno = credentials['panno']

shn = Shoonya(username, access_token, panno, key,
              token, usercode, usertype, master_contracts_to_download=['NSE', 'NFO'])

bal = shn.get_limits()
print(bal)
df = pd.DataFrame(bal, index=None)
df['MTM'] = df['REALISED_PROFITS'] + df['MTM_COMBINED']
print(df[['MTM','REALISED_PROFITS', 'AMOUNT_UTILIZED',
      'CLEAR_BALANCE', 'AVAILABLE_BALANCE', 'MTM_COMBINED']])

scrip = shn.get_instrument_by_symbol('NSE', 'SBIN')
print(scrip)

Check complete example in examples folder

  • Here using_existing_access_tokens.py is present for help

Release files for shoonya 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shoonya 0.1.4
File Size Uploaded
shoonya-0.1.4.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shoonya 0.1.4
File Interpreter ABI Platform
shoonya-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / shoonya-0.1.4.tar.gz

Download URL shoonya-0.1.4.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
59b2b0da5f2f4281a633ab7b8cc8892e2ec9e42c6f4cab564c382f6b3980604d
BLAKE2b-256 checksum
How to use checksums
f95731e24cba00b8e2bd87062e1886161d031e64963c2640d8b87fb4d7590e76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.6.8 Windows/10

Release files / shoonya-0.1.4-py3-none-any.whl

Download URL shoonya-0.1.4-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eeda4af09e3940c8683f2beeb3f5df13e8392916349e3f2a31db4bf8c8682583
BLAKE2b-256 checksum
How to use checksums
5cd29646cb88ac445034624586f3193c3172f39e9492f39b0328494fe7b80041
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.6.8 Windows/10

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page