-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: trading api draft account activities endpoint
- Loading branch information
1 parent
fa0a9e6
commit bbbc660
Showing
10 changed files
with
598 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from uuid import UUID | ||
from alpaca.trading.models import BaseActivity as TradingBaseActivity | ||
from alpaca.trading.models import NonTradeActivity as BaseNonTradeActivity | ||
from alpaca.trading.models import TradeActivity as BaseTradeActivity | ||
|
||
|
||
class BaseActivity(TradingBaseActivity): | ||
""" | ||
Base model for activities that are retrieved through the Broker API. | ||
Attributes: | ||
id (str): Unique ID of this Activity. Note that IDs for Activity instances are formatted like | ||
`20220203000000000::045b3b8d-c566-4bef-b741-2bf598dd6ae7` the first part before the `::` is a date string | ||
while the part after is a UUID | ||
account_id (UUID): id of the Account this activity relates too | ||
activity_type (ActivityType): What specific kind of Activity this was | ||
""" | ||
|
||
account_id: UUID | ||
|
||
def __init__(self, *args, **data): | ||
if "account_id" in data and type(data["account_id"]) == str: | ||
data["account_id"] = UUID(data["account_id"]) | ||
|
||
super().__init__(*args, **data) | ||
|
||
|
||
class NonTradeActivity(BaseNonTradeActivity, BaseActivity): | ||
"""NonTradeActivity for the Broker API.""" | ||
|
||
|
||
class TradeActivity(BaseTradeActivity, BaseActivity): | ||
"""TradeActivity for the Broker API.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.