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

coinbase_pro.js --> Stop Order Error #293

Open
rooks88 opened this issue Apr 7, 2022 · 1 comment
Open

coinbase_pro.js --> Stop Order Error #293

rooks88 opened this issue Apr 7, 2022 · 1 comment

Comments

@rooks88
Copy link

rooks88 commented Apr 7, 2022

Hi there,
I got this error msg:
Coinbase Pro: order create error: ["HTTP 400 Error: Invalid order_type stop

As I read in the api doc, there ist no stop order in CB Pro. See: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postorders

Furthermore there are stop-loss and stop-entry flags, which are not included in the submittet order-post.

I'm wondering if the marked part in the coinbase_pro.js could easily be redirected to to another type....

let orderType;
switch (ordType) {
case 'limit':
orderType = ExchangeOrder.TYPE_LIMIT;
break;
case 'stop':
orderType = ExchangeOrder.TYPE_STOP;
break;

case 'market':
orderType = ExchangeOrder.TYPE_MARKET;
break;
case 'stoplimit':
orderType = ExchangeOrder.TYPE_STOP_LIMIT;
break;
default:
orderType = ExchangeOrder.TYPE_UNKNOWN;
break;
}

... or if it's just necessary to cut out this marked part, as there are just no stop orders in CB Pro:

let orderType;
const originOrderType = order.getType();
if (!originOrderType || originOrderType === 'limit') {
orderType = 'limit';
} else if (originOrderType === 'stop') {
orderType = 'stop';

} else if (originOrderType === 'market') {
orderType = 'market';
}

But on the other hand, there is a reason for the bot to choose the stop-order-type. If there are no stop-orders, the possibility of choosing stop-orders should be deleted from the choosing-type-process in the code, as simple manipulation as mentioned above would lead to a possible WIN or LOSS which would be connected to the chosen stop-order afterwards.

I am not quite sure how to handle this, maybe I am mistaking my problem from the very beginning.

I'm appreaciating any answer. Thanks!

Cheerio

Robin

@rooks88
Copy link
Author

rooks88 commented Apr 7, 2022

As I read further through the web I'm gettin the impression the coinbase Pro stop order is simply different in syntax:

authenticatedClient.sell( {
type: "limit",
product_id: "BTC-USD",
size: "0.005",
price: "10100", // the limit price
stop: "entry", // currently undocumented
stop_price: "10000", // currently undocumented
});

I found this example which indicates the type is staying "limit", but there is a choice of "stop-types" entry/loss and a stop_price which needs to be passed to fulfill the order requierements.
Any ideas about that?

Thanks & cheers!

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

1 participant