Name | fyers-testing JSON |
Version |
2.1
JSON |
| download |
home_page | https://github.com/ |
Summary | Fyers trading APIs. |
upload_time | 2023-06-30 14:16:39 |
maintainer | |
docs_url | None |
author | Fyers-Tech |
requires_python | |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# The Fyers API Python client - v2.1
The official Python client for communicating with the [Fyers API](https://myapi.fyers.in)
## Documentation
- [Python client documentation](https://myapi.fyers.in/docs)
## Requirements
- Python v3
## Installation
Install via [pip](https://pypi.org/project/fyers-apiv2/)
pip install fyers-apiv2@latest
## Breaking changes - v2.1
`v2.1` is a **breaking** major release with multiple internal modification to improve user experience.<br>
Below are the breaking changes:
- list of changes
## Getting started with access token generation
```Python
import webbrowser
from fyerstest.fyers_api import SessionModel
def getauthToken(client_id, redirect_uri, response_type, scope, state, nonce):
"""
The variable `generateTokenUrl` will have a url like
https://uat-api.fyers.in/api/dev/generate-authcode?appId=B8PWLVH8T6&redirectUrl=https%3A%2F%2Fgoogle.com
1. This function open this url in the browser.
2. This will ask you to login and will ask you to approve the app if it is not approved already.
3. Once that is done, it will redirect to a url (added while app creation) with the auth_code. The url will look like
https://www.google.com/?auth_code=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTM1ODY2NzEsInN1YiI6ImF1dGhDb2RlIiwiYXBwX2lkIjoiQjhQV0xWSDhUNiIsImlzcyI6ImFwaS5sb2dpbi5meWVycy5pbiIsImF1ZCI6WyJ4OjAiLCJ4OjEiLCJ4OjIiXSwidXVpZCI6ImZhOGNhYjE3ZWU4OTQzMGRhZjA1YWUxNDI2YWVkYzI4IiwiaXBBZGRyIjoiMjIzLjIzMy40Mi40NiIsImRpc3BsYXlfbmFtZSI6IkRQMDA0MDQiLCJpYXQiOjE1OTM1ODYzNzEsIm5iZiI6MTU5MzU4NjM3MX0.IMJHzQGHQgyXt_XN0AgDrMN1keR4qolFFKO6cyXTnTg&user_id=DP00404
4. You have to take the auth_code from the url and use that token in your generate_access_token function.
"""
appSession = SessionModel(client_id=client_id, redirect_uri=redirect_uri,
response_type=response_type, scope=scope, state=state, nonce=nonce)
generateTokenUrl = appSession.generate_authcode()
print((generateTokenUrl))
webbrowser.open(generateTokenUrl, new=1)
def generate_access_token(auth_code, client_id, redirect_uri, secret_key, grant_type):
"""
:param auth_code: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTM1ODY2NzEsInN1YiI6ImF1dGhDb2RlIiwiYXBwX2lkIjoiQjhQV0xWSDhUNiIsImlzcyI6ImFwaS5sb2dpbi5meWVycy5pbiIsImF1ZCI6WyJ4OjAiLCJ4OjEiLCJ4OjIiXSwidXVpZCI6ImZhOGNhYjE3ZWU4OTQzMGRhZjA1YWUxNDI2YWVkYzI4IiwiaXBBZGRyIjoiMjIzLjIzMy40Mi40NiIsImRpc3BsYXlfbmFtZSI6IkRQMDA0MDQiLCJpYXQiOjE1OTM1ODYzNzEsIm5iZiI6MTU5MzU4NjM3MX0.IMJHzQGHQgyXt_XN0AgDrMN1keR4qolFFKO6cyXTnTg"
:param app_id: "B8PWLVH8T6"
:param secret_key: "575XQDKGN0"
:param redirect_url: "https://google.com"
:return: access_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTM1ODgzNzMsIm5iZiI6MTU5MzU4ODM3MywiZXhwIjoxNTkzNjQ5ODEzLCJpc3MiOiJhcGkuZnllcnMuaW4iLCJzdWIiOiJhY2Nlc3MiLCJhdWQiOiJ4OjAseDoxLHg6MiIsImF0X2hhc2giOiJnQUFBQUFCZV9EcVZIZExMMTAzTVpVN1NYSkZfR2p5R3hidzMtTVVhb0VEMGI0QUVvNjFsR24tREY2OFU5cXhuNzd0UXVoOVVJalYtNm9MVXhINVFfWE1WTEJfRXpROGV2clJmUzlNUXB0Y2J5c2ltN1drWllZTT0iLCJkaXNwbGF5X25hbWUiOiJQSVlVU0ggUkFKRU5EUkEgS0FQU0UiLCJmeV9pZCI6IkRQMDA0MDQifQ.cAfrj2TxAyb8A_9DfiCb1hLIZg_mH-xvP3Ybnj3a4AE"
1.this function takes the param and return the access_token
2.the access_token created will be used further .(in fyersModel)]
3. one can get the auth_code from the url generated by getauthToken function (from auth_code= ..... &user_Id=xxxxxx before &)
"""
# import ipdb;
# ipdb.set_trace()
appSession = SessionModel(client_id=client_id, redirect_uri=redirect_uri,
secret_key=secret_key, grant_type=grant_type)
appSession.set_token(auth_code)
access_token = appSession.generate_token()
return access_token
def main():
# Define the required parameters
redirect_uri = "https://trade.fyers.in/api-login/redirect-uri/index.html"
client_id = "XC4XXX67IM-100"
secret_key = "5OXXX3DM8"
grant_type = "authorization_code"
response_type = "code"
state = "sample_state"
nonce = "baka"
scope = "openid"
# Step 1: Get authorization token
getauthToken(client_id, redirect_uri, response_type, scope, state, nonce)
# Step 2: Obtain authorization code
# Add the obtained authorization code here
auth_code = "XXXxxx"
# Step 3: Generate access token
access_token = generate_access_token(auth_code, client_id, redirect_uri, secret_key, grant_type)
print(access_token)
```
## Getting started wih API
```Python
from fyerstest.fyers_api import FyersModelv3
def api_call(access_token, clientId, log_path):
functionName = "api_call"
"""
:param access_token: "https://XXXXXX.com"
:param app_id: "XXXXXXXXXXX"
:param log_path: "home/gfxcgv/vgghvb/xxxx"
"""
# If you want to make asynchronous API calls then assign the below variable as True and then pass it in the functions, by default its value is False
is_async = False
# Creating an instance of fyers model in order to call the apis
fyers = FyersModelv3(token=access_token, is_async=is_async, log_path=log_path, client_id=clientId)
# Setting the AccessToken
fyers.token = access_token
## uncomment the any of the following requests to send a particular request and get the required data
# print(fyers.get_profile())
# print(fyers.tradebook())
# print(fyers.positions())
# print(fyers.holdings())
# print(fyers.funds())
# print(fyers.orderbook())
# print(fyers.cancel_order({'id':'8080582117761'}))
# print(fyers.place_order({"symbol":"NSE:SBIN-EQ","qty":1,"type":1,"side":1,"productType":"INTRADAY","limitPrice":0,"stopPrice":0,"disclosedQty":0,"validity":"DAY","offlineOrder":"False","stopLoss":0,"takeProfit":0}))
# print(fyers.modify_order({"id":"808058117761", "qty":"0","type":"1","limitPrice":"71100","stopPrice":"0"})) #modify instead of update
# print(fyers.convert_position({"symbol":"MCX:SILVERMIC20AUGFUT","positionSide":"1","convertQty":"1","convertFrom":"MARGIN","convertTo":"INTRADAY"}))
# print(fyers.get_orders({'id':'808078094451'}))
# print(fyers.market_status())
# print(fyers.exit_positions({"id":"MCX:SILVERMIC20AUGFUT-MARGIN"}))
# print(fyers.generate_data_token({"vendorApp":"0KMS0EZVXI"}))
# print(fyers.cancel_basket_orders([{"id":"120080780536"},{"id":"120080777069"}]))
# print(fyers.place_basket_orders([{"symbol":"NSE:SBIN-EQ","qty":"1","type":"1","side":"1","productType":"INTRADAY","limitPrice":"191","stopPrice":"0","disclosedQty":"0","validity":"DAY","offlineOrder":"False","stopLoss":"0","takeProfit":"0"},{"symbol":"NSE:SBIN-EQ","qty":"1","type":"1","side":"1","productType":"INTRADAY","limitPrice":"191","stopPrice":"0","disclosedQty":"0","validity":"DAY","offlineOrder":"False","stopLoss":"0","takeProfit":"0"}]))
# print(fyers.modify_basket_orders([{"id":"120080780536", "type":1, "limitPrice": 190, "stopPrice":0},{"id":"120080777069", "type":1, "limitPrice": 190}]))
# print(fyers.quotes(data={"symbols":"NSE:TCS-EQ"}))
# print(fyers.depth(data={"symbol":"NSE:TCS-EQ,NSE:SBIN-EQ","ohlcv_flag":"1"}))
# data = {"symbol":"NSE:SBIN-EQ","resolution":"10","date_format":"0","range_from":"1686481206","range_to":"1686567665","cont_flag":"1"}
# print(fyers.history(data))
if __name__ == '__main__':
# the access token returned fro generate_access_token(x,x,x,x) function from getAccessToken.py module
access_token = "eyJ0eXAiOiJieDoxIiwieDoyIiwiZDoxIiwiZDoyIiwieDoxIiwieDowIl0sInN1YiI6ImFjY2Vzc190b2tlbiIsImF0X2hhc2giOiJnQUFBQUFCa25ucldKVEhfWXRpREcyVnlldUJTN2Z6NzE0YzBlTUpaa3BUcGRHWURQR2daT0t5RTZ5SmVPa3N0WTVyNExBX2NpTUZtQ0d1d0xuamp5VWhPckVJTzNjZHNqM1laNHJQMzc0dHdXeVRPQlJpVEUxbz0iLCJkaXNwbGF5X25hbWUiOiJWSU5BWSBLVU1BUiBNQVVSWUEiLCJvbXMiOiJLMSIsImZ5X2lkIjoiWFYyMDk4NiIsImFwcFR5cGUiOjEwMCwicG9hX2ZsYWciOiJOIn0.yWShR1T8DHIZYqZgt3GE8xaSYLMfcFpHMLSGenE92lA"
# The app id we get after creating the app
clientId = "XCXXXXXIM-100"
# The system path where we want to store the logs e.g-c:\user\vvvv\xxxx\nnnn
log_path = None
## uncomment any of the function in the api_call to get the required output
api_call(access_token, appId, log_path)
```
## Getting started with Data Socket
```python
from fyerstest.data_ws import FyersDataSocket
# Specify your access token
access_token = "XCXXXXXIM-100:eyJ0eXAiOiJKV1QiLCJyVnlldUJTN2Z6NzE0YzBlTUpaa3BUcGRHWURQR2daT0t5RTZ5SmVPa3N0WTVyNExBX2NpTUZtQ0d1d0xuamp5VWhPckVJTzNjZHNqM1laNHJQMzc0dHdXeVRPQlJpVEUxbz0iLCJkaXNwbGF5X25hbWUiOiJWSU5BWSBLVU1BUiBNQVVSWUEiLCJvbXMiOiJLMSIsImZ5X2lkIjoiWFYyMDk4NiIsImFwcFR5cGUiOjEwMCwicG9hX2ZsYWciOiJOIn0.yWShR1T8DHIZYqZgt3GE8xaSYLMfcFpHMLSGenE92lA"
# Specify the data type and symbols you want to subscribe to
data_type = "SymbolUpdate"
symbols = ['NSE:NIFTY50-INDEX', "NSE:HDFC-EQ"]
# Create an instance of FyersDataSocket
fyData = FyersDataSocket(access_token=access_token, log_path=None, litemode=True)
# Subscribe to the specified symbols and data type
fyData.subscribe(symbols=symbols, data_type=data_type)
# Unsubscribe from the specified symbols and data type
fyData.unsubscribe(symbols=symbols, data_type=data_type)
# Keep the socket running to receive real-time data
fyData.keep_running()
```
## Getting started with Order Socket
```python
from fyerstest.data_ws import FyersDataSocket
# Specify your access token
access_token = "XCXXXXXIM-100:eyJ0eXAiOiJKV1QiLCJyVnlldUJTN2Z6NzE0YzBlTUpaa3BUcGRHWURQR2daT0t5RTZ5SmVPa3N0WTVyNExBX2NpTUZtQ0d1d0xuamp5VWhPckVJTzNjZHNqM1laNHJQMzc0dHdXeVRPQlJpVEUxbz0iLCJkaXNwbGF5X25hbWUiOiJWSU5BWSBLVU1BUiBNQVVSWUEiLCJvbXMiOiJLMSIsImZ5X2lkIjoiWFYyMDk4NiIsImFwcFR5cGUiOjEwMCwicG9hX2ZsYWciOiJOIn0.yWShR1T8DHIZYqZgt3GE8xaSYLMfcFpHMLSGenE92lA"
# Create an instance of FyersDataSocket
fyOrder = FyersOrderSocket(access_token=access_token, log_path=None)
# Subscribe to the specified data type
data_type = "OnOrders,OnTrades"
fyOrder.subscribe(data_type=data_type)
# Unsubscribe to the specified data type
data_type = "OnTrades"
fyOrder.unsubscribe(data_type=data_type)
# Keep the socket running to receive real-time data
fyOrder.keep_running()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/",
"name": "fyers-testing",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Fyers-Tech",
"author_email": "support@fyers.in",
"download_url": "https://files.pythonhosted.org/packages/13/68/a26faf5afd0a3ca1e7590c4498c1f0aff93a169a1059602a605bf3d56697/fyers-testing-2.1.tar.gz",
"platform": null,
"description": "# The Fyers API Python client - v2.1\n\nThe official Python client for communicating with the [Fyers API](https://myapi.fyers.in)\n\n## Documentation\n\n- [Python client documentation](https://myapi.fyers.in/docs)\n\n## Requirements\n\n- Python v3\n\n## Installation\n\nInstall via [pip](https://pypi.org/project/fyers-apiv2/)\n\n pip install fyers-apiv2@latest\n\n## Breaking changes - v2.1\n\n`v2.1` is a **breaking** major release with multiple internal modification to improve user experience.<br>\n\nBelow are the breaking changes:\n\n- list of changes\n\n## Getting started with access token generation\n\n```Python\nimport webbrowser\nfrom fyerstest.fyers_api import SessionModel\n\n\ndef getauthToken(client_id, redirect_uri, response_type, scope, state, nonce):\n \"\"\"\n The variable `generateTokenUrl` will have a url like\n https://uat-api.fyers.in/api/dev/generate-authcode?appId=B8PWLVH8T6&redirectUrl=https%3A%2F%2Fgoogle.com\n 1. This function open this url in the browser.\n 2. This will ask you to login and will ask you to approve the app if it is not approved already.\n\n 3. Once that is done, it will redirect to a url (added while app creation) with the auth_code. The url will look like\n https://www.google.com/?auth_code=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTM1ODY2NzEsInN1YiI6ImF1dGhDb2RlIiwiYXBwX2lkIjoiQjhQV0xWSDhUNiIsImlzcyI6ImFwaS5sb2dpbi5meWVycy5pbiIsImF1ZCI6WyJ4OjAiLCJ4OjEiLCJ4OjIiXSwidXVpZCI6ImZhOGNhYjE3ZWU4OTQzMGRhZjA1YWUxNDI2YWVkYzI4IiwiaXBBZGRyIjoiMjIzLjIzMy40Mi40NiIsImRpc3BsYXlfbmFtZSI6IkRQMDA0MDQiLCJpYXQiOjE1OTM1ODYzNzEsIm5iZiI6MTU5MzU4NjM3MX0.IMJHzQGHQgyXt_XN0AgDrMN1keR4qolFFKO6cyXTnTg&user_id=DP00404\n 4. You have to take the auth_code from the url and use that token in your generate_access_token function.\n\n \"\"\"\n appSession = SessionModel(client_id=client_id, redirect_uri=redirect_uri,\n response_type=response_type, scope=scope, state=state, nonce=nonce)\n generateTokenUrl = appSession.generate_authcode()\n print((generateTokenUrl))\n webbrowser.open(generateTokenUrl, new=1)\n\n\ndef generate_access_token(auth_code, client_id, redirect_uri, secret_key, grant_type):\n \"\"\"\n :param auth_code: \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTM1ODY2NzEsInN1YiI6ImF1dGhDb2RlIiwiYXBwX2lkIjoiQjhQV0xWSDhUNiIsImlzcyI6ImFwaS5sb2dpbi5meWVycy5pbiIsImF1ZCI6WyJ4OjAiLCJ4OjEiLCJ4OjIiXSwidXVpZCI6ImZhOGNhYjE3ZWU4OTQzMGRhZjA1YWUxNDI2YWVkYzI4IiwiaXBBZGRyIjoiMjIzLjIzMy40Mi40NiIsImRpc3BsYXlfbmFtZSI6IkRQMDA0MDQiLCJpYXQiOjE1OTM1ODYzNzEsIm5iZiI6MTU5MzU4NjM3MX0.IMJHzQGHQgyXt_XN0AgDrMN1keR4qolFFKO6cyXTnTg\"\n :param app_id: \"B8PWLVH8T6\"\n :param secret_key: \"575XQDKGN0\"\n :param redirect_url: \"https://google.com\"\n :return: access_token: \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTM1ODgzNzMsIm5iZiI6MTU5MzU4ODM3MywiZXhwIjoxNTkzNjQ5ODEzLCJpc3MiOiJhcGkuZnllcnMuaW4iLCJzdWIiOiJhY2Nlc3MiLCJhdWQiOiJ4OjAseDoxLHg6MiIsImF0X2hhc2giOiJnQUFBQUFCZV9EcVZIZExMMTAzTVpVN1NYSkZfR2p5R3hidzMtTVVhb0VEMGI0QUVvNjFsR24tREY2OFU5cXhuNzd0UXVoOVVJalYtNm9MVXhINVFfWE1WTEJfRXpROGV2clJmUzlNUXB0Y2J5c2ltN1drWllZTT0iLCJkaXNwbGF5X25hbWUiOiJQSVlVU0ggUkFKRU5EUkEgS0FQU0UiLCJmeV9pZCI6IkRQMDA0MDQifQ.cAfrj2TxAyb8A_9DfiCb1hLIZg_mH-xvP3Ybnj3a4AE\"\n\n 1.this function takes the param and return the access_token\n 2.the access_token created will be used further .(in fyersModel)]\n 3. one can get the auth_code from the url generated by getauthToken function (from auth_code= ..... &user_Id=xxxxxx before &)\n \"\"\"\n # import ipdb;\n # ipdb.set_trace()\n appSession = SessionModel(client_id=client_id, redirect_uri=redirect_uri,\n secret_key=secret_key, grant_type=grant_type)\n appSession.set_token(auth_code)\n access_token = appSession.generate_token()\n return access_token\n\ndef main():\n\n # Define the required parameters\n redirect_uri = \"https://trade.fyers.in/api-login/redirect-uri/index.html\"\n client_id = \"XC4XXX67IM-100\"\n secret_key = \"5OXXX3DM8\"\n grant_type = \"authorization_code\"\n response_type = \"code\"\n state = \"sample_state\"\n nonce = \"baka\"\n scope = \"openid\"\n\n # Step 1: Get authorization token\n getauthToken(client_id, redirect_uri, response_type, scope, state, nonce)\n \n # Step 2: Obtain authorization code\n # Add the obtained authorization code here\n auth_code = \"XXXxxx\"\n \n # Step 3: Generate access token\n access_token = generate_access_token(auth_code, client_id, redirect_uri, secret_key, grant_type)\n print(access_token)\n\n\n```\n\n## Getting started wih API\n\n```Python\n\nfrom fyerstest.fyers_api import FyersModelv3\n\n\ndef api_call(access_token, clientId, log_path):\n functionName = \"api_call\"\n \"\"\"\n :param access_token: \"https://XXXXXX.com\"\n :param app_id: \"XXXXXXXXXXX\"\n :param log_path: \"home/gfxcgv/vgghvb/xxxx\"\n \"\"\"\n\n # If you want to make asynchronous API calls then assign the below variable as True and then pass it in the functions, by default its value is False\n is_async = False\n\n # Creating an instance of fyers model in order to call the apis\n fyers = FyersModelv3(token=access_token, is_async=is_async, log_path=log_path, client_id=clientId)\n\n # Setting the AccessToken\n fyers.token = access_token\n\n ## uncomment the any of the following requests to send a particular request and get the required data\n # print(fyers.get_profile())\n # print(fyers.tradebook())\n # print(fyers.positions())\n # print(fyers.holdings())\n # print(fyers.funds())\n # print(fyers.orderbook())\n # print(fyers.cancel_order({'id':'8080582117761'}))\n # print(fyers.place_order({\"symbol\":\"NSE:SBIN-EQ\",\"qty\":1,\"type\":1,\"side\":1,\"productType\":\"INTRADAY\",\"limitPrice\":0,\"stopPrice\":0,\"disclosedQty\":0,\"validity\":\"DAY\",\"offlineOrder\":\"False\",\"stopLoss\":0,\"takeProfit\":0}))\n # print(fyers.modify_order({\"id\":\"808058117761\", \"qty\":\"0\",\"type\":\"1\",\"limitPrice\":\"71100\",\"stopPrice\":\"0\"})) #modify instead of update\n # print(fyers.convert_position({\"symbol\":\"MCX:SILVERMIC20AUGFUT\",\"positionSide\":\"1\",\"convertQty\":\"1\",\"convertFrom\":\"MARGIN\",\"convertTo\":\"INTRADAY\"}))\n # print(fyers.get_orders({'id':'808078094451'}))\n # print(fyers.market_status())\n # print(fyers.exit_positions({\"id\":\"MCX:SILVERMIC20AUGFUT-MARGIN\"}))\n # print(fyers.generate_data_token({\"vendorApp\":\"0KMS0EZVXI\"}))\n # print(fyers.cancel_basket_orders([{\"id\":\"120080780536\"},{\"id\":\"120080777069\"}]))\n # print(fyers.place_basket_orders([{\"symbol\":\"NSE:SBIN-EQ\",\"qty\":\"1\",\"type\":\"1\",\"side\":\"1\",\"productType\":\"INTRADAY\",\"limitPrice\":\"191\",\"stopPrice\":\"0\",\"disclosedQty\":\"0\",\"validity\":\"DAY\",\"offlineOrder\":\"False\",\"stopLoss\":\"0\",\"takeProfit\":\"0\"},{\"symbol\":\"NSE:SBIN-EQ\",\"qty\":\"1\",\"type\":\"1\",\"side\":\"1\",\"productType\":\"INTRADAY\",\"limitPrice\":\"191\",\"stopPrice\":\"0\",\"disclosedQty\":\"0\",\"validity\":\"DAY\",\"offlineOrder\":\"False\",\"stopLoss\":\"0\",\"takeProfit\":\"0\"}]))\n # print(fyers.modify_basket_orders([{\"id\":\"120080780536\", \"type\":1, \"limitPrice\": 190, \"stopPrice\":0},{\"id\":\"120080777069\", \"type\":1, \"limitPrice\": 190}]))\n # print(fyers.quotes(data={\"symbols\":\"NSE:TCS-EQ\"}))\n # print(fyers.depth(data={\"symbol\":\"NSE:TCS-EQ,NSE:SBIN-EQ\",\"ohlcv_flag\":\"1\"}))\n # data = {\"symbol\":\"NSE:SBIN-EQ\",\"resolution\":\"10\",\"date_format\":\"0\",\"range_from\":\"1686481206\",\"range_to\":\"1686567665\",\"cont_flag\":\"1\"}\n # print(fyers.history(data))\n\n\nif __name__ == '__main__':\n # the access token returned fro generate_access_token(x,x,x,x) function from getAccessToken.py module\n access_token = \"eyJ0eXAiOiJieDoxIiwieDoyIiwiZDoxIiwiZDoyIiwieDoxIiwieDowIl0sInN1YiI6ImFjY2Vzc190b2tlbiIsImF0X2hhc2giOiJnQUFBQUFCa25ucldKVEhfWXRpREcyVnlldUJTN2Z6NzE0YzBlTUpaa3BUcGRHWURQR2daT0t5RTZ5SmVPa3N0WTVyNExBX2NpTUZtQ0d1d0xuamp5VWhPckVJTzNjZHNqM1laNHJQMzc0dHdXeVRPQlJpVEUxbz0iLCJkaXNwbGF5X25hbWUiOiJWSU5BWSBLVU1BUiBNQVVSWUEiLCJvbXMiOiJLMSIsImZ5X2lkIjoiWFYyMDk4NiIsImFwcFR5cGUiOjEwMCwicG9hX2ZsYWciOiJOIn0.yWShR1T8DHIZYqZgt3GE8xaSYLMfcFpHMLSGenE92lA\"\n\n # The app id we get after creating the app\n clientId = \"XCXXXXXIM-100\"\n\n # The system path where we want to store the logs e.g-c:\\user\\vvvv\\xxxx\\nnnn\n log_path = None\n ## uncomment any of the function in the api_call to get the required output\n api_call(access_token, appId, log_path)\n\n\n```\n\n## Getting started with Data Socket\n\n```python\n\nfrom fyerstest.data_ws import FyersDataSocket\n\n# Specify your access token\naccess_token = \"XCXXXXXIM-100:eyJ0eXAiOiJKV1QiLCJyVnlldUJTN2Z6NzE0YzBlTUpaa3BUcGRHWURQR2daT0t5RTZ5SmVPa3N0WTVyNExBX2NpTUZtQ0d1d0xuamp5VWhPckVJTzNjZHNqM1laNHJQMzc0dHdXeVRPQlJpVEUxbz0iLCJkaXNwbGF5X25hbWUiOiJWSU5BWSBLVU1BUiBNQVVSWUEiLCJvbXMiOiJLMSIsImZ5X2lkIjoiWFYyMDk4NiIsImFwcFR5cGUiOjEwMCwicG9hX2ZsYWciOiJOIn0.yWShR1T8DHIZYqZgt3GE8xaSYLMfcFpHMLSGenE92lA\"\n\n# Specify the data type and symbols you want to subscribe to\ndata_type = \"SymbolUpdate\"\nsymbols = ['NSE:NIFTY50-INDEX', \"NSE:HDFC-EQ\"]\n\n# Create an instance of FyersDataSocket\nfyData = FyersDataSocket(access_token=access_token, log_path=None, litemode=True)\n\n# Subscribe to the specified symbols and data type\nfyData.subscribe(symbols=symbols, data_type=data_type)\n\n# Unsubscribe from the specified symbols and data type\nfyData.unsubscribe(symbols=symbols, data_type=data_type)\n\n# Keep the socket running to receive real-time data\nfyData.keep_running()\n\n```\n\n\n## Getting started with Order Socket\n\n```python\n\nfrom fyerstest.data_ws import FyersDataSocket\n\n# Specify your access token\naccess_token = \"XCXXXXXIM-100:eyJ0eXAiOiJKV1QiLCJyVnlldUJTN2Z6NzE0YzBlTUpaa3BUcGRHWURQR2daT0t5RTZ5SmVPa3N0WTVyNExBX2NpTUZtQ0d1d0xuamp5VWhPckVJTzNjZHNqM1laNHJQMzc0dHdXeVRPQlJpVEUxbz0iLCJkaXNwbGF5X25hbWUiOiJWSU5BWSBLVU1BUiBNQVVSWUEiLCJvbXMiOiJLMSIsImZ5X2lkIjoiWFYyMDk4NiIsImFwcFR5cGUiOjEwMCwicG9hX2ZsYWciOiJOIn0.yWShR1T8DHIZYqZgt3GE8xaSYLMfcFpHMLSGenE92lA\"\n\n# Create an instance of FyersDataSocket\nfyOrder = FyersOrderSocket(access_token=access_token, log_path=None)\n\n# Subscribe to the specified data type\ndata_type = \"OnOrders,OnTrades\"\nfyOrder.subscribe(data_type=data_type)\n\n# Unsubscribe to the specified data type\ndata_type = \"OnTrades\"\nfyOrder.unsubscribe(data_type=data_type)\n\n# Keep the socket running to receive real-time data\nfyOrder.keep_running()\n\n\n\n```\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Fyers trading APIs.",
"version": "2.1",
"project_urls": {
"Homepage": "https://github.com/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "95391017f34fb3eb0bd088d8b0c5b1ab18b03403a2e705b7e935f8d69a45037f",
"md5": "24beeba2e7135984826a8e0af331ce13",
"sha256": "020a5dac6e1c3f56dc0bba42ed5805ff4511d69bf42a151fc7aea13d55a68303"
},
"downloads": -1,
"filename": "fyers_testing-2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24beeba2e7135984826a8e0af331ce13",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 22125,
"upload_time": "2023-06-30T14:16:36",
"upload_time_iso_8601": "2023-06-30T14:16:36.409180Z",
"url": "https://files.pythonhosted.org/packages/95/39/1017f34fb3eb0bd088d8b0c5b1ab18b03403a2e705b7e935f8d69a45037f/fyers_testing-2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1368a26faf5afd0a3ca1e7590c4498c1f0aff93a169a1059602a605bf3d56697",
"md5": "a92a892002d6646fb1dc5646a1c37658",
"sha256": "b6d59b9b69da6be9709bf6022bb5f137ea1c73a8052fd54a686cee65fd238803"
},
"downloads": -1,
"filename": "fyers-testing-2.1.tar.gz",
"has_sig": false,
"md5_digest": "a92a892002d6646fb1dc5646a1c37658",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20831,
"upload_time": "2023-06-30T14:16:39",
"upload_time_iso_8601": "2023-06-30T14:16:39.624659Z",
"url": "https://files.pythonhosted.org/packages/13/68/a26faf5afd0a3ca1e7590c4498c1f0aff93a169a1059602a605bf3d56697/fyers-testing-2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-30 14:16:39",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fyers-testing"
}