alpacahq / alpacahq/alpaca-trade-api-js

[Bug]: Cannot open bracket order starting with sell stop

Open
#248 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
601
Forks
155
Avg merge
21h 14m
Merged PRs (30d)
10

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

When I call the alpaca api with
```
{
symbol: 'SPY',
qty: 35,
side: 'sell',
type: 'stop',
order_class: 'bracket',
stop_price: 455.67,
time_in_force: 'day',
take_profit: { limit_price: 455 },
stop_loss: { stop_price: 455.96 }
}
```
It returned an error:
```
{ code: 42210000, message: 'bracket orders must be entry orders' }
```

### Expected Behavior

_No response_

### SDK Version I encountered this issue in

@alpacahq/alpaca-trade-api ^3.0.1

### Steps To Reproduce

```markdown
Call:

alpaca.createOrder({
symbol: 'SPY',
qty: 35,
side: 'sell',
type: 'stop',
order_class: 'bracket',
stop_price: 455.67,
time_in_force: 'day',
take_profit: { limit_price: 455 },
stop_loss: { stop_price: 455.96 }
})
```
```

### Filled out the Steps to Reproduce section?

- [X] I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

### Anything else?

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.