You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@validator("type")
def order_type_must_be_market_for_lct(cls, value: OrderType) -> OrderType:
"""
Order type must always be market if currency is not USD.
See https://alpaca.markets/docs/broker/integration/lct/#submit-stock-trade
"""
if cls.currency and value != OrderType.MARKET:
raise ValueError(
"Order type must be OrderType.MARKET if the order is in a local currency."
)
return value
cls refers to the class, which since this is a pydantic class does not have currency on it
OrderRequest.order_type_must_be_market_for_lct(cls, value)
676 breakpoint()
677 print()
--> 679 if cls.currency and value != OrderType.MARKET:
680 raise ValueError(
681 "Order type must be OrderType.MARKET if the order is in a local currency."
682 )
683 return value
AttributeError: type object 'OrderRequest' has no attribute 'currency'
we can see this here:
(Pdb) cls
<class 'alpaca.broker.requests.OrderRequest'>
(Pdb) l
672 Order type must always be market if currency is not USD.
673 See https://alpaca.markets/docs/broker/integration/lct/#submit-stock-trade
674 """
675
676 breakpoint()
677 -> print()
678
679 if cls.currency and value != OrderType.MARKET:
680 raise ValueError(
681 "Order type must be OrderType.MARKET if the order is in a local currency."
682 )
(Pdb) cls
<class 'alpaca.broker.requests.OrderRequest'>
(Pdb) dir(cls)
['Config', '__abstractmethods__', '__annotations__', '__class__', '__class_vars__', '__config__', '__custom_root_type__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__exclude_fields__', '__fields__', '__fields_set__', '__format__', '__ge__', '__get_validators__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__include_fields__', '__init__', '__init_subclass__', '__iter__', '__json_encoder__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__post_root_validators__', '__pre_root_validators__', '__pretty__', '__private_attributes__', '__reduce__', '__reduce_ex__', '__repr__', '__repr_args__', '__repr_name__', '__repr_str__', '__schema_cache__', '__setattr__', '__setstate__', '__signature__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__try_update_forward_refs__', '__validators__', '_abc_impl', '_calculate_keys', '_copy_and_set_values', '_decompose_class', '_enforce_dict_if_root', '_get_value', '_init_private_attributes', '_iter', 'construct', 'copy', 'dict', 'from_orm', 'json', 'order_type_must_be_market_for_lct', 'parse_file', 'parse_obj', 'parse_raw', 'root_validator', 'schema', 'schema_json', 'to_request_fields', 'update_forward_refs', 'validate']
Expected Behavior
order object to be created
SDK Version I encountered this issue in
0.8.1
Steps To Reproduce
just try and create any order
Filled out the Steps to Reproduce section?
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
The text was updated successfully, but these errors were encountered:
@validator('password2')
def passwords_match(cls, v, values, **kwargs):
if 'password1' in values and v != values['password1']:
raise ValueError('passwords do not match')
return v
Is there an existing issue for this?
Current Behavior
cls refers to the class, which since this is a pydantic class does not have currency on it
if you try to instantiate any order you get:
we can see this here:
Expected Behavior
order object to be created
SDK Version I encountered this issue in
0.8.1
Steps To Reproduce
Filled out the Steps to Reproduce section?
Anything else?
No response
The text was updated successfully, but these errors were encountered: