-
Notifications
You must be signed in to change notification settings - Fork 48
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
Error with shorting (sell) positions #20
Comments
Hi,
For the sell positions is required to specify SL and TP values, have you done that?
You can verify it with Bitcoin its market is open even on weekends.
Best regards
Oleg
…________________________________
От: WarlaxZ <[email protected]>
Отправлено: 9 января 2021 г. 0:33
Кому: ok24601/etoro-api <[email protected]>
Копия: Subscribed <[email protected]>
Тема: [ok24601/etoro-api] Error with shorting (sell) positions (#20)
Whenever I try to create a short position it fails
Unfortunately I don't have the error now as the market is closed, however will try and get it on monday. I just want to confirm that the library supports shorts, as it looks as if it does.
Will confirm that buys went through completely fine, it was just an issue with 'sells' (and I don't mean closing an open position, mean a shot position).
Let me know if there is anything else I can provide you with
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#20>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADHNNVTCBJD6KPORGZSDBBDSY6B3LANCNFSM4V3BPZXA>.
|
originally I had (but it was part of a larger program so couldnt directly see the results) - however nice shout on the btc - will test locally now. wonder if my issue may have been due to some positions requiring larger SL/TP - but will investigate. thank you for the response! |
ah can't test - now that u cant buy cfd and u have to buy the underlying asset, u cant short (button not available in etoro UI) - so currently see this error (although this is correct that it errors) { Will wait until market opens monday and provide more details :) |
Ok just confirmed, tried to short TUI.L I see this error:
And the stack trace in the logs is:
And for full confirmation, watchlist looks like this:
And position being sent was:
(Confirmed those TP/SL values were valid from the etoro front end) |
hi,
thanks fore pointing this out,
i'll look how to fix it.
Oleg
…________________________________
От: WarlaxZ <[email protected]>
Отправлено: 11 января 2021 г. 12:28
Кому: ok24601/etoro-api <[email protected]>
Копия: ok24601 <[email protected]>; Comment <[email protected]>
Тема: Re: [ok24601/etoro-api] Error with shorting (sell) positions (#20)
Also tried with:
"takeProfitRate": 500.00,
"stopLossRate": 320.00,
Just to really test the water, but still failed
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#20 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADHNNVSAAESYMMD3ZXTVKCTSZLHGHANCNFSM4V3BPZXA>.
|
Hero, thank you so much for this library! |
I've done a quick look to see what the actual packet should look like when sent to etoro, hopefully this help!:
buy position for reference:
difference I can spot:
Looking at your code nothing jumps out at me, but I don't have an IDE installed to breakpoint it to see the actual error, although IsBuy looks like its set correctly If theres anything else I can help with, please let me know, I'm desperate to get this working and this is literally the final piece for me, so I'm more than happy to help where I can |
ok, thanks for this overview it's helpfull, it can be it's because price for SELL is discounted, in theory my code should use discounted price in this case but may be smthng went wrong
…________________________________
От: WarlaxZ <[email protected]>
Отправлено: 11 января 2021 г. 14:40
Кому: ok24601/etoro-api <[email protected]>
Копия: ok24601 <[email protected]>; Comment <[email protected]>
Тема: Re: [ok24601/etoro-api] Error with shorting (sell) positions (#20)
I've done a quick look to see what the actual packet should look like when sent to etoro, hopefully this help!:
https://www.etoro.com/sapi/trade-demo/positions?client_request_id=XXXXX
{
"CID":XXXXX,
"InstrumentID":2163,
"IsBuy":false,
"Leverage":1,
"StopLossRate":374.62,
"TakeProfitRate":279.31,
"IsTslEnabled":true,
"View_UnitMargin":4.82908408,
"View_MaxPositionUnits":1440,
"View_Units":1041.61,
"View_openByUnits":false,
"IsDiscounted":false,
"ViewRateContext": {
"ClientViewRate":358.48,
"ClientViewRateID":XXXX,
"ClientRateForCalc":359.7,
"ClientRateForCalcID":XXXX
},
"Amount":5030,
"View_Source_Application":"apps-components-autocomplete-autocomplete.view-trade-button",
"View_Source_Location":"/portfolio",
"View_CurrentTradingMode":"REGULAR"
}
buy position for reference:
https://www.etoro.com/sapi/trade-demo/positions?client_request_id=XXXX'
{
"CID":XXXX,
"InstrumentID":2163,
"IsBuy":true,
"Leverage":1,
"StopLossRate":351.95,
"TakeProfitRate":1158.88,
"IsTslEnabled":false,
"View_UnitMargin":4.8496525,
"View_MaxPositionUnits":1440,
"View_Units":20.62,
"View_openByUnits":false,
"IsDiscounted":true,
"ViewRateContext":{
"ClientViewRate":359.9,
"ClientViewRateID":XXXX,
"ClientRateForCalc":360,
"ClientRateForCalcID":XXXX
},
"Amount":100,
"View_Source_Application":"apps-components-autocomplete-autocomplete.view-trade-button",
"View_Source_Location":"/portfolio",
"View_CurrentTradingMode":"REGULAR"
}
difference I can spot:
"IsBuy":false,
"IsDiscounted":false,
Looking at your code nothing jumps out at me, but I don't have an IDE installed to breakpoint it to see the actual error, although IsBuy looks like its set correctly
If theres anything else I can help with, please let me know, I'm desperate to get this working and this is literally the final piece for me, so I'm more than happy to help where I can
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#20 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADHNNVQSIFXOUXVRHCFBTXDSZLWT7ANCNFSM4V3BPZXA>.
|
maybe worth adding an override param perhaps. from what I can see in your code it calls:
might be worth changing it to |
sorry i mean (type = position.type.equals(PositionType.BUY)) |
nope re-ran is isdiscounted set to false and that doesnt seem to have done the magic trick :/ |
So I tried replaying an actual post an I dont get an error, however the position didnt open (presumably because the ID for calc might have been a dupe, not entirely sure. Also one thing I noticed as that the caps get lost in you post body, ie your looks like this:
so vs a real packet we're missing:
|
u had any joy with this? not being able to set any breakpoints to investigate properly was killing me yesterday, that and I've not used kotlin before :P let me know if theres anything I can help you with to get this up and running though |
hi, I din't get a chance to take a look on that, had a lot of work this week. Will probably do it on weekends.
…________________________________
От: WarlaxZ <[email protected]>
Отправлено: 12 января 2021 г. 13:07
Кому: ok24601/etoro-api <[email protected]>
Копия: ok24601 <[email protected]>; Comment <[email protected]>
Тема: Re: [ok24601/etoro-api] Error with shorting (sell) positions (#20)
u had any joy with this? not being able to set any breakpoints to investigate properly was killing me yesterday, that and I've not used kotlin before :P let me know if theres anything I can help you with to get this up and running though
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#20 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADHNNVUZHDYZEE5RJO7TDBDSZQUQ3ANCNFSM4V3BPZXA>.
|
ok - once again thank you so much for the library, and do let me know if there is anything you need from me to assist |
any luck? |
nope couldnt test it because market was closed on weekends, will try to fix it on the week |
ah lol didnt think about that either, stupid markets :P as always let me know if theres anything i can do to assist |
By me is not able to open trades on LOGN.ZU. Seem that don't like to open trades on assets with extension .L, .ZU :) Is possible to use uppercase or lowercase in all assets because I see cryptos, forex are in uppercase? |
i'm fairly certain i get the same issue with american stocks, so no '.blah' extention (for example "bb") - but the casing thing certainly is annoying, might be worth a .lower()/upper() (or language equivalent) on all variables just to harmonize them, as symbols are case insensitive |
how u getting on? |
bump |
Whenever I try to create a short position it fails
Unfortunately I don't have the error now as the market is closed, however will try and get it on monday. I just want to confirm that the library supports shorts, as it looks as if it does.
Will confirm that buys went through completely fine, it was just an issue with 'sells' (and I don't mean closing an open position, mean a shot position).
Let me know if there is anything else I can provide you with
The text was updated successfully, but these errors were encountered: