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

feat: Adjust account configuration #403

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alpaca/trading/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class TradeConfirmationEmail(str, Enum):
"""
Used for controlling when an Account will receive a trade confirmation email.

please see https://alpaca.markets/docs/api-references/broker-api/trading/trading-configurations/#attributes
please see https://docs.alpaca.markets/reference/getaccountconfig
for more info.
"""

Expand Down
2 changes: 2 additions & 0 deletions alpaca/trading/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ class AccountConfiguration(BaseModel):
suspend_trade (bool): If true Account becomes unable to submit new orders
trade_confirm_email (TradeConfirmationEmail): Controls whether Trade confirmation emails are sent.
ptp_no_exception_entry (bool): If set to true then Alpaca will accept orders for PTP symbols with no exception. Default is false.
max_option_trading_level (Optional[str]): The desired maximum option trading level. 0=disabled, 1=Covered Call/Cash-Secured Put, 2=Long Call/Put.
"""

dtbp_check: DTBPCheck
Expand All @@ -548,6 +549,7 @@ class AccountConfiguration(BaseModel):
suspend_trade: bool
trade_confirm_email: TradeConfirmationEmail
ptp_no_exception_entry: bool
max_option_trading_level: Optional[str] = None


class CorporateActionAnnouncement(ModelWithID):
Expand Down
4 changes: 3 additions & 1 deletion tests/trading/trading_client/test_account_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ def test_get_account_configurations(reqmock: Mocker, trading_client: TradingClie
"max_margin_multiplier": "4",
"pdt_check": "entry",
"trade_confirm_email": "all",
"ptp_no_exception_entry": false
"ptp_no_exception_entry": false,
"max_option_trading_level": "1"
}
""",
)

account_configurations = trading_client.get_account_configurations()
assert reqmock.called_once
assert isinstance(account_configurations, AccountConfiguration)
assert account_configurations.max_option_trading_level == "1"


def test_set_account_configurations(reqmock: Mocker, trading_client: TradingClient):
Expand Down