Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GTT trigger value is not allowed to be int #10

Closed
VarunAgw opened this issue Jul 14, 2020 · 1 comment
Closed

[Bug] GTT trigger value is not allowed to be int #10

VarunAgw opened this issue Jul 14, 2020 · 1 comment

Comments

@VarunAgw
Copy link

VarunAgw commented Jul 14, 2020

This is an example request

https://pastebin.com/raw/6NKK1C9q

You see the library is stripping the part containing [40].

The exact line with the issues are:
https://github.com/zerodhatech/phpkiteconnect/blob/master/kiteconnect.php#L1185 https://github.com/zerodhatech/phpkiteconnect/blob/master/kiteconnect.php#L1124

It replaces [40] by ``. I don't know why this line of code was added but it should be smarter and not delete the important data.

https://kite.trade/forum/discussion/comment/27316


Update: I seem to have find why it was added.

D:\www\trading\kite\kiteconnect.php:1190:
array (size=1)
'i' =>
array (size=2)
0 => string 'NSE:ICICIBANK' (length=13)
1 => string 'NSE:RELIANCE' (length=12)

D:\www\trading\kite\kiteconnect.php:1191:string 'i%5B0%5D=NSE%3AICICIBANK&i%5B1%5D=NSE%3ARELIANCE' (length=48)
D:\www\trading\kite\kiteconnect.php:1193:string 'i=NSE%3AICICIBANK&i=NSE%3ARELIANCE' (length=34)

Kite API because of some poor decision doesn't like i[0]=s&i[1]=d so the API decided to strip the array part of it and make it i=s&i=d which is VERY WRONG.

It tries to do the same for GTT trigger thinking it's an index key.

D:\www\trading\kite\kiteconnect.php:1190:
array (size=4)
'condition' => string '{"exchange":"BSE","tradingsymbol":"RCOM","trigger_values":[40],"last_price":0}' (length=78)
'orders' => string '[{"transaction_type":"SELL","order_type":"LIMIT","product":"CNC","quantity":8500,"price":0,"exchange":"BSE","tradingsymbol":"RCOM"}]' (length=132)
'type' => string 'single' (length=6)
'trigger_id' => int 8760636
D:\www\trading\kite\kiteconnect.php:1191:string 'condition=%7B%22exchange%22%3A%22BSE%22%2C%22tradingsymbol%22%3A%22RCOM%22%2C%22trigger_values%22%3A%5B40%5D%2C%22last_price%22%3A0%7D&orders=%5B%7B%22transaction_type%22%3A%22SELL%22%2C%22order_type%22%3A%22LIMIT%22%2C%22product%22%3A%22CNC%22%2C%22quantity%22%3A8500%2C%22price%22%3A0%2C%22exchange%22%3A%22BSE%22%2C%22tradingsymbol%22%3A%22RCOM%22%7D%5D&type=single&trigger_id=8760636' (length=387)
D:\www\trading\kite\kiteconnect.php:1193:string 'condition=%7B%22exchange%22%3A%22BSE%22%2C%22tradingsymbol%22%3A%22RCOM%22%2C%22trigger_values%22%3A%2C%22last_price%22%3A0%7D&orders=%5B%7B%22transaction_type%22%3A%22SELL%22%2C%22order_type%22%3A%22LIMIT%22%2C%22product%22%3A%22CNC%22%2C%22quantity%22%3A8500%2C%22price%22%3A0%2C%22exchange%22%3A%22BSE%22%2C%22tradingsymbol%22%3A%22RCOM%22%7D%5D&type=single&trigger_id=8760636' (length=379)

Pretty dumb.

@vividvilla
@knadh

@ranjanrak
Copy link
Member

@VarunAgw
This is fixed in our new refactor version using the Guzzle HTTP client form_params option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants