Giter VIP home page Giter VIP logo

py5paisa's People

Contributors

5paisa avatar ba11b0y avatar gd5paisa avatar jenishsiifl avatar tarunw07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py5paisa's Issues

Error while logging in

  • 5paisa Python SDK version:
  • Python version:3.8
  • Operating System:Mac OS

Getting the below error while attempting to login

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/py5paisa/py5paisa.py", line 51, in login
message = res["body"]["Message"]
TypeError: 'NoneType' object is not subscriptable

Exchange and exchange types

Is there a help which tells what the values for the following parameters?

For example, to get marketfeed. The following options needed to be sent. What are the options for each and what do they mean?

  1. Expiry
  2. StrikePrice
  3. OptionType

Cryptic(Null in binary) value coming in "Exch" field for all the Apis

I'm not using the python SDK directly but I've used the official docs (https://invest.5paisa.com/DeveloperAPI/) to make Apis for myself.

When I query any API, the response I'm getting is correct however the "Exch" value is coming as "'\x00" (Null in binary)

Example response for Holdings API :

{'body': {'CacheTime': 300, 'Data': [{'BseCode': 540787, 'CurrentPrice': 36.52, 'DPQty': 1, 'Exch': '\x00', 'ExchType': 'C', 'FullName': 'ICICIPRAMC - BHARATIWIN', 'NseCode': 522, 'POASigned': 'N', 'PoolQty': 0, 'Quantity': 1, 'ScripMultiplier': 1, 'Symbol': 'ICICIB22'}], 'Message': 'Success', 'Status': 0}, 'head': {'responseCode': '5PHoldingV2', 'status': '0', 'statusDescription': 'Success'}}

I tried with python SDK as well getting same response

Unable to login. Exception: Please configure your keys in keys.conf

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

The first time I tried to login, it showed a logged in!! message. But thereafter, I am not able to login. every time i run the script, I get the error: Exception: Please configure your keys in keys.conf.
I have saved my keys in keys.conf file as per the instruction and saved the file in the directory where i have kept the script. Still it shows the same error.

What I Did

from py5paisa import FivePaisaClient
client = FivePaisaClient(email="k*****************[email protected]", passwd="***********", dob="********")
client.login()
( in place of * i have used my credentials)

The output:
Traceback (most recent call last):

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\conf.py", line 9, in <module>
    section = config["KEYS"]

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\configparser.py", line 958, in __getitem__
    raise KeyError(key)

KeyError: 'KEYS'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "<ipython-input-1-7999cee77a8c>", line 1, in <module>
    from py5paisa import FivePaisaClient

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\__init__.py", line 1, in <module>
    from py5paisa.py5paisa import FivePaisaClient

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\py5paisa.py", line 2, in <module>
    from .auth import EncryptionClient

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\auth.py", line 8, in <module>
    from .conf import ENCRYPTION_KEY

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\conf.py", line 11, in <module>
    raise Exception("Please configure your keys in keys.conf")

Exception: Please configure your keys in keys.conf

Has anyone faced similar issue? If so, what can be done?

Regards
Chinmaya

F&O Support

Hi,

Does the API support placing orders in Futures?

Regards,
Kiran

unable to do authentication

  • 5paisa Python SDK version:0.1.6
  • Python version:3.7.7
  • Operating System:Win10

Description

I just configure the keys.conf file and tried executing client.login()
but it ended up with below error :
Traceback (most recent call last):
File "main_paisa.py", line 4, in
client.login()
File ".................\py5paisa\py5paisa.py", line 51, in login
message = res["body"]["Message"]
TypeError: 'NoneType' object is not subscriptable

Please note: I have configured keys.conf file without quotes and provided proper input to FivePaisaClient() like below:
client = FivePaisaClient(email="[email protected]", passwd="xxxxxxx", dob="yyyymmdd")

'Order rejected by RMS. Check holding, Short selling restricted in delivery product for equity'

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

What does this error imply?? I have necessary funds in my acc, and it is still firing this error constantly!!

What I Did

my code:

order = Order(order_type=OrderType.SELL, scrip_code=script_code, quantity=1,
ahplaced=AHPlaced.AFTER_MARKET_CLOSED, price=close_price, atmarket=False, stoploss_price=stoploss)
client.place_order(order)

Oauth Support

Does py5paisa support oauth ? Is this feature in pipeline ?

Unable to place FnO orders

  • 5paisa Python SDK version: 0.1.8
  • Python version: 3.8.5
  • Operating System: Ubuntu

Description

Unable to place FnO orders due to Scrip does not exist error. Cash orders working fine.

using scrip_code = 59706 for NIFTY2140115000CE . The same scrip code is seen in UI when I inspect using Chrome Debugger.

What I Did

I am trying to place order for buying NIFTY2140115000CE 1 lot using

test_order = Order(order_type=OrderType.BUY, scrip_code='59706', exchange_segment=ExchangeSegment.DERIVATIVE, quantity=75)
client.place_order(test_order)

However, I get following response

 20:38:20 | Scrip does not exist
{'BrokerOrderID': 0,
 'ClientCode': 'xxxxx',
 'Exch': 'B',
 'ExchOrderID': '',
 'ExchType': 'D',
 'LocalOrderID': 0,
 'Message': 'Scrip does not exist',
 'RMSResponseCode': 1,
 'ScripCode': 59706,
 'Status': 0,
 'Time': '/Date(1617203300886+0530)/'}

Am I missing anything here?

Thanks in advance,

SL order not working

Stoploss order for derivatives are not working. Getting rejected by exachange.Screenshot_20200922-155130.jpg

How to place SL-M order

I am able to place stop loss with trigger price and limit orders, How can we place SL-M order via api..

If I keep limit price 0, getting error Invalid Limit rate received.

Regards,
Ritesh

Empty Buy/Sell Avg Rate for USDINR position

  • 5paisa API
  • Operating System: Win10

Description

Trying to get USDINR positions data. But buy or sell avg rate is zero because of which unbooked PL is wrong.

What I Did

Endpoint URL - "https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V1/NetPositionNetWise"
Request Payload - {"head":{"appName":"5PAKASH","appVer":"1.0", "key":"****",
                                "osName":"WEB","requestCode":"","userId":"****",
                                 "password":"****"},"body":{"ClientCode":"***"}}
Response Sample - 
{"BodQty"=>1,
  "BookedPL"=>0,
  "BuyAvgRate"=>0,
  "BuyQty"=>0,
  "BuyValue"=>0,
  "Exch"=>"N",
  "ExchType"=>"U",
  "LTP"=>0.815,
  "MTOM"=>-45,
  "Multiplier"=>1000,
  "NetQty"=>1,
  "OrderFor"=>"D",
  "PreviousClose"=>0.86,
  "ScripCode"=>9175,
  "ScripName"=>"USDINR 29 Dec 2020 CE 73.0000",
  "SellAvgRate"=>0,
  "SellQty"=>0,
  "SellValue"=>0},
 {"BodQty"=>-2,
  "BookedPL"=>0,
  "BuyAvgRate"=>0,
  "BuyQty"=>0,
  "BuyValue"=>0,
  "Exch"=>"N",
  "ExchType"=>"U",
  "LTP"=>0.0425,
  "MTOM"=>10,
  "Multiplier"=>1000,
  "NetQty"=>-2,
  "OrderFor"=>"D",
  "PreviousClose"=>0.0475,
  "ScripCode"=>9191,
  "ScripName"=>"USDINR 29 Dec 2020 CE 75.0000",
  "SellAvgRate"=>0,
  "SellQty"=>0,
  "SellValue"=>0},

API Limit exceeded Exception

There is an API Limit of 10 requests per minute.

  1. Is this for the entire API or only placing orders?
  2. How to know that the API Limit is exceeded? Is there a built-in exception or a header response or a json response to identify this
  3. Can the API Limit be increased?

Sandbox availability for testing

how to test the code that I write using the rest apis?? Is there any paper trading/sandbox kind of thing available to make sure the parameters are correctly passed and the order is placed. I just down want to play with real money and real trades just for testing.

404 not found for pip install pyp5aisa

Command "pip install pyp5aisa" responds with 404 not found. looks like api5paisa is the actual name.
Is this correct if yes please update the readme installation steps.

How to put in AMO orders?

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

exchange_type=ExchangeType.CASH does not exist

  • 5paisa Python SDK version:
  • Python version: 3.7.6
  • Operating System:

Description

exchange_type=ExchangeType.CASH does not exist
example given in docs

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)

What I Did

I changed exchange_type to exchange_segment

from py5paisa.order import OrderForStatus, Exchange, ExchangeSegment, RequestList
YES_BANK_SCRIP_CODE = '11915'
test_order_status = OrderForStatus(exchange=Exchange.BSE, exchange_segment=ExchangeSegment.CASH,scrip_code=YES_BANK_SCRIP_CODE, order_id=0)

Fetching Account Balance - Feature Request

Description

I don't see any option to fetch the account balance after the client.login() method. The docs say you can get the holdings, order book, margins and positions. There's no option of account balance. Is it possible to add it? Something like: client.balance()

Thank you for such wonderful API!

how to get advanced portfolio details using api

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Issue while using encrypted key

  • 5paisa Python SDK version: 0.2.1
  • Python version: Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)]
  • Operating System: Windows 10

Description

While using code with email id, password and DOB as plain text the program works fine. But while using encrypted form, the Program fails. PFB errors.

output (Errors - Runtime)

Traceback (most recent call last):
File "C:...\xxx.py", line 5, in
client.login()
File "C:...\Python\Python39\lib\site-packages\py5paisa\py5paisa.py", line 56, in login
res = self._login_request(self.LOGIN_ROUTE)
File "C:...\Python\Python39\lib\site-packages\py5paisa\py5paisa.py", line 79, in login_request
return res.json()
File "C:...\Python\Python39\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "C:...\Python\Python39\lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
File "C:...\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:...\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Thanks.

new Login API V4 returns null JWTToken

Description

Jwt token from new Login API V4 returns "JWTToken": null and "statusDescription" is "Success

Request from postman

curl -X POST \
  https://openapi.5paisa.com/VendorsAPI/Service1.svc/V4/LoginRequestMobileNewbyEmail \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
    "head": {
        "appName": "app name from [apikeys link](https://invest.5paisa.com/DeveloperAPI/APIKeys)",
        "appVer": "1.0",
        "key": "User Key from [apikeys link](https://invest.5paisa.com/DeveloperAPI/APIKeys)",
        "osName": "WEB",
        "requestCode": "5PLoginV4",
        "userId": "user id from [apikeys link](https://invest.5paisa.com/DeveloperAPI/APIKeys)",
        "password": "password from from [apikeys link](https://invest.5paisa.com/DeveloperAPI/APIKeys)"
    },
    "body": {
        "Email_id": "email from [encryption link](https://invest.5paisa.com/developerapi/authorization)",
        "Password": "password from [encryption link](https://invest.5paisa.com/developerapi/authorization)",
        "LocalIP": "192.168.0.109",
        "PublicIP": "192.168.0.109",
        "HDSerailNumber": "",
        "MACAddress": "",
        "MachineID": "039377",
        "VersionNo": "1.7",
        "RequestNo": "1",
        "My2PIN": "date of birth from [encryption link](https://invest.5paisa.com/developerapi/authorization)",
        "ConnectionType": "1"
    }
}'

Output

{
    "body": {
        "AllowBseCash": "",
        "AllowBseDeriv": "",
        "AllowBseMF": "",
        "AllowMCXComm": "",
        "AllowMcxSx": "",
        "AllowNSECurrency": "",
        "AllowNSEL": "",
        "AllowNseCash": "",
        "AllowNseComm": "",
        "AllowNseDeriv": "",
        "AllowNseMF": "",
        "BulkOrderAllowed": 0,
        "CleareDt": "/Date(1620963000000+0530)/",
        "ClientCode": "",
        "ClientName": "",
        "ClientType": 0,
        "DemoTrial": "",
        "EmailId": "",
        "InteractiveLocalIP": "",
        "InteractivePort": 0,
        "InteractivePublicIP": "",
        "IsIDBound": 0,
        "IsIDBound2": 0,
        "IsOnlyMF": "",
        "IsPLM": 0,
        "IsPLMDefined": 0,
        "JWTToken": null,
        "LastAccessedTime": "/Date(1621004899690+0530)/",
        "LastLogin": "",
        "LastPasswordChange": null,
        "LastPasswordModify": "/Date(1621004899690+0530)/",
        "Message": "Invalid Input Parameters.",
        "OTPCredentialID": "",
        "PLMsAllowed": 0,
        "POAStatus": "\u0000",
        "PasswordChangeFlag": 0,
        "PasswordChangeMessage": "",
        "RunningAuthorization": 0,
        "ServerDt": "/Date(1621004899690+0530)/",
        "Status": 2,
        "TCPBCastPort": 0,
        "TCPBcastLocalIP": "",
        "TCPBcastPublicIP": "",
        "UDPBCastPort": 0,
        "UDPBcastIP": "",
        "ValidUpto": null,
        "VendorName": null,
        "VersionChanged": 0
    },
    "head": {
        "responseCode": "5PLoginV4",
        "status": "0",
        "statusDescription": "Success"
    }
}

I have doubt on "Message": "Invalid Input Parameters." but dont know which input is wrong

Thanks alot for any help!

Cancel order and Modify order do not work

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

Cancel order and Modify order do not work and throw a error

Code:
client.cancel_order(exch_order_id=320007170, traded_qty=1, scrip_code=890147)

Error: Client handler to Exchange Connector connection stopped',

at_market is True by default and doesn't consider passed price

  • 5paisa Python SDK version: 0.1.6
  • Python version: 3.6.9
  • Operating System: Ubuntu 18.04

Description

order = Order(order_type = OrderType.BUY, scrip_code = 1333, quantity = 1, price = 1300, exchange = Exchange.NSE, exchange_segment = ExchangeSegment.CASH)

This just got through and the buy order was placed at market price. The market price attribute is not even written in the documentation I found here.

What I Did

So finally I had to do this, and then it worked as expected. I sincerely request you to re-check the documentation and update it accordingly.

order = Order(order_type = OrderType.BUY, scrip_code = 1333, quantity = 1, price = 1300, exchange = Exchange.NSE, exchange_segment = ExchangeSegment.CASH, atmarket = False)

I think the atmarket should be recalculated if the price passed in is 0 (market order) otherwise it should be False.

Bracket Order Support

Description

There are still a lot of options from the normal web platform or from android app which are not available through API. Is there any chance that Bracket Order Support would get added to the API shortly?

I think 5Paisa already has a is_stop_loss and stop_loss parameters into the Order API. Just something like is_bracket_order and/or target_price parameters have to be added.

If it's not possible, I think 5Paisa should at least add webhook support, so the user's code can do the task of placing orders or cancelling them and that code itself would handle the bracket order functions.

Edit: Also if trailing_stop_loss is added, that would help a lot!

Thanks!

Can I get live price ticks of any script

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Cannot get any method other than login

Only the client.login method works.
Other methods either raise an error or prints only the timestamp
When I run, client.order_book(), I get this output

13:24:25 |
I have both live pending orders and positions
When I checked at the start of the day, it displayed No orders

I tried a plain python request using the session object like this

import json
payload = {
    "head": client.payload['head'],
    "body": {
        "clientCode": client.client_code
    }
}
payload['head']['requestCode'] = client.ORDER_BOOK_REQUEST_CODE
req = client.session.post(url=client.ORDER_BOOK_ROUTE, data=json.dumps(payload),
                    headers={'Content-Type': 'application/json'})

I get the following output

{'body': {'Message': 'Error while processing your request.',
  'OrderBookDetail': [],
  'Status': -1},
 'head': {'responseCode': '5POrdBkV2',
  'status': '0',
  'statusDescription': 'Success'}}

Options trading

is it possible to place buy/sell orders in Options using this API?

how to place limit order

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

i am not able to find how to place the limit order

Order_id

How to get the order I'd of a order placed.. couldn't find anywhere as response

Not Able to install py5paisa

  • 5paisa Python SDK version:
  • Python version: 3.8.5
  • Operating System: windows server 2019 @ AWS

Unable to install py5paisa, getting error due to pycrypto which i understand is discontinued, Please guide how to install this.

warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -Ic:\users\administrator\appdata\local\programs\python\python38-32\include -Ic:\users\administrator\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/winrand.c /Fobuild\temp.win32-3.8\Release\src/winrand.obj

cannot import exchange type from order.py

Traceback (most recent call last):
File "E:\jugs\n\test_h.py", line 2, in
from py5paisa.order import Order, OrderType, Exchange,OrderForStatus, ExchangeType, RequestList
ImportError: cannot import name 'ExchangeType' from 'py5paisa.order' (C:\Users\satish\AppData\Local\Programs\Python\Python37\lib\site-packages\py5paisa\order.py)

Error while fetching trade info and order status

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

Error while fetching trade info and order status

Throwing error --> Object of type Exchange is not JSON serializable

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

from py5paisa.order import OrderForStatus, Exchange, RequestList
test_order_status = OrderForStatus(exchange=Exchange.BSE, exchange_segment=ExchangeSegment.CASH, scrip_code=890147, 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)

client.fetch_order_status(req_list)
client.fetch_trade_info(req_list)

ExchangeType module dosen't exists in the pacakage!!

ANY GET AROUND TO THIS??

code:
from py5paisa import FivePaisaClient
from py5paisa.order import OrderForStatus, Exchange, RequestList, ExchangeType

client = FivePaisaClient(xxxxxxxx)
client.login()
test_order_status = OrderForStatus(exchange=Exchange.NSE, scrip_code=11915, order_id=0, exchange_type=ExchangeType.CASH)

Error:
Traceback (most recent call last):
File "C:\Users\Phantom\PycharmProjects\Quanta\test3.py", line 2, in
from py5paisa.order import OrderForStatus, Exchange, RequestList, ExchangeType
ImportError: cannot import name 'ExchangeType' from 'py5paisa.order' (C:\Users\Phantom\AppData\Local\Programs\Python\Python39\lib\site-packages\py5paisa\order.py)

how to get USER_KEY

  • 5paisa Python SDK version:latest
  • Python version: latest
  • Operating System:ubuntu

Description

Confusion about USER_KEY and ENCRYPTION_KEY

where can i find userkey

  • is userkey and encryption key both same ?
  • i understand encryption key is the one we add in https://invest.5paisa.com/DeveloperAPI/Authorization url
  • here its written UserKey generated at the time of registration,do we have to do any kind of registration before using api's. i already have trading account with 5paisa
  • also there is not much documentation on how to get userkey

where can i find userkey ?

Any help would be great Thanks.

Unable to cancel orders.

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

Unable to cancel orders.

What I Did

Following is my request

mod_order=Order(order_type=OrderType.BUY, scrip_code=scrip_code,quantity=qty,
              order_for=OrderFor.CANCEL, exchange=Exchange.NSE, exchange_segment=ExchangeSegment.CASH, exch_order_id=order_id,
              atmarket=False, is_intraday=False,price=price)
        resp=self.client.place_order(mod_order)

I always get 00:57:48 | Order information not found error.

I called it via a function using which I was trying to cancel an order. The json object obtained using order_book() for order that I was trying to cancel is as follows:

{'AHProcess': 'N', 'AfterHours': 'Y', 'AtMarket': 'N', 'BrokerOrderId': 383048970, 'BrokerOrderTime': '/Date(1611512627467+0530)/', 'BuySell': 'B', 'DelvIntra': 'D', 'DisClosedQty': 0, 'Exch': 'B', 'ExchOrderID': '383048970', 'ExchOrderTime': '/Date(315513000000+0530)/', 'ExchType': 'C', 'MarketLot': 1, 'OldorderQty': 0, 'OrderRequesterCode': '56105291 ', 'OrderStatus': 'AH Placed ', 'OrderValidUpto': '24 Jan 2021', 'OrderValidity': 0, 'PendingQty': 1, 'Qty': 1, 'Rate': 73.3, 'Reason': '', 'RequestType': 'P', 'SLTriggerRate': 0, 'SLTriggered': 'N', 'SMOProfitRate': 0, 'SMOSLLimitRate': 0, 'SMOSLTriggerRate': 0, 'SMOTrailingSL': 0, 'ScripCode': 500469, 'ScripName': 'FEDERALBNK', 'TerminalId': 0, 'TradedQty': 0, 'WithSL': 'N'}

Can someone please tell me how shall I form a request in order to cancel this order via api?

Cover Order

I dont find any flag to indicate the order is cover order or bracket order.
test_order = Order(order_type=OrderType.BUY, scrip_code=3045, quantity=1, exchange=Exchange.NSE, is_intraday=True, stoploss_price=185)
can you please check and update example

facing issue to login as stated in py5paisa help doc

Hello sir,
I have been trying to use 5paisa trading api but as i have followed all the instructions as stated in the helpdocs for python but when I am trying to call client.login() method it is throwing me below error (sending the traceback) kindly guide me what am I mistaking or if mistake is from your side kindly update it.

Traceback (most recent call last):
File "5paisa_demo.py", line 16, in
client.login()
File "xxx/xxx/py5paisa.py", line 52, in login
message = res["body"]["Message"]
TypeError: 'NoneType' object is not subscriptable

Unable to get Margin through API : "403 : Access denied."

  • 5paisa : Using APIs only with Ruby
  • Operating System: Windows 10

Description

Using the margin API, I am getting 403 access denied as status Description. Below is the JSON response:
{"body"=>nil, "head"=>{"responseCode"=>"5PMarginV3", "status"=>"-2", "statusDescription"=>"403 : Access denied."}}

What I Did

Request url: "https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V3/Margin"
Request payload:

{:head=>{:appName=>"5PAKASH", :appVer=>"1.0", :key=>"****", :osName=>"WEB", :requestCode=>"5PMarginV3", :userId=>"****", :password=>"****"},
 :body=>{:ClientCode=>"****", :Email_id=>"****", :Password=>"****", :My2PIN=>"****"}}

Any suggestions what might be wrong?! Also, I am using ruby for the API calls, and able to get the positions, holdings and other stuff.

BO order for options

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Description

Is it possible to place BO order for options? I tried to use correct script code which works with regular order but it doesn't work with bo_co_order and bo_order. The problem seems to be that I can't pass exchange and exchange_segment to bo_co_order. Can you please provide appropriate function calls?

Feat: Add trading symbol compatibility

Feature request:

Existing

  • The API needs a scrip code to place an order.

Requested feature

  • Give the users an option to place orders using either of scrip code or a trading symbol

Issue with requesting market feed for BANKNIFTY FUT

  • 5paisa Python SDK version:
  • Python version:
  • Operating System:

Issue with market feed while requesting for BANKNIFTY FUT

I Used the below code
req_list_=[{"Exch":"N","ExchType":"D","Symbol":"BANKNIFTY 27 MAY 2021 FUT","Expiry":"20210527","StrikePrice":"0","OptionType":""}]

Invalid session

Hi
@invinciblycool

  • 5paisa Python SDK version: 0.1.5
  • Python version: 3.6.10

Description

Keep getting invalid session message

What I Did

  • I tried the python API but could not log in
  • I tried with a fresh requests object and could log in but I cannot get any other method working either in Python or Javascript
  • A plain POST request over reqbin also fails.

I get the following errors when running calling the positions URL

{
    "body": {
        "Message": "Invalid Session",
        "NetPositionDetail": [],
        "Status": 9
    },
    "head": {
        "responseCode": "5PNPNWV1",
        "status": "0",
        "statusDescription": "Invalid Session"
    }
}

and the following error when requesting the margins URL

{
    "body": {
        "ClientCode": "59808196",
        "EquityMargin": [],
        "Message": "Invalid Session",
        "Status": 9,
        "TimeStamp": "\/Date(1598626953085+0530)\/"
    },
    "head": {
        "responseCode": "5PMarginV3",
        "status": "0",
        "statusDescription": "Success"
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.