Skip to content

Conversation

@matebudai
Copy link
Contributor

@matebudai matebudai commented May 27, 2024

Context

Extend Order API with a new field called commission_type.

Possible values:

  • notional(default, API backward compatible so that when type is not specified notional is assumed)
  • qty(charge commission on a per quantity basis, which make it possible to charge commission on per contract basis in case of options)
  • bps
class CommissionType(str, Enum):
    """
    Represents the available ways of charging commission. This determines how
    the value in the commission field is interpreted.
    """

    NOTIONAL = "notional"
    BPS = "bps"
    QTY = "qty"

Changes

  • Introduce the new enum type.
  • Extend broker API order request model with the new field.
  • poetry update black

@matebudai matebudai requested a review from hiohiohio as a code owner May 27, 2024 12:25
@matebudai matebudai force-pushed the feature-commission-type branch from 185f010 to b554eb8 Compare May 27, 2024 12:43
Copy link
Contributor

@hiohiohio hiohiohio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! Left small comments.

@@ -0,0 +1,182 @@
from alpaca.broker.client import BrokerClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

assert reqmock.call_count == 2
assert isinstance(mo_response, Order)
assert mo_response.status == OrderStatus.ACCEPTED
assert mo_response.commission == 1.25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like this?

Suggested change
assert mo_response.commission == 1.25
assert mo_response.commission == 0
assert mo_response.commission_bps == 100

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.
efc9a61

@matebudai matebudai marked this pull request as draft May 30, 2024 12:24
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

Successfully merging this pull request may close these issues.

3 participants