question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

broker account creation - rejected employment_status (with a correct enum)

See original GitHub issue

if we include the employment_status (with a correct enum), it will be rejected with message: “value is not a valid enumeration member”

No issue by API

Screen Shot 2022-11-16 at 10 40 05

the code in Google Colab: https://colab.research.google.com/drive/1XO0lEAqKsro_1i6et3B0lgUZmud61vxl

the code to reproduce:

!pip install -q alpaca-py==0.6.0 
import requests
import alpaca.broker as brokerapi
from numpy import trace
import pandas as pd
from alpaca.broker.requests import CreateAccountRequest
from alpaca.broker.client import BrokerClient
from alpaca.broker.models import (
                        Contact,
                        Identity,
                        Disclosures,
                        Agreement
                    )
from alpaca.broker.enums import TaxIdType, FundingSource, AgreementType

api_id='' 
api_key=''

client = brokerapi.BrokerClient(api_id, api_key)

# Contact
contact_data = Contact(
            email_address="test41421aa4141@example.com",
            phone_number="555-666-7788",
            street_address=["20 N San Mateo Dr"],
            city="San Mateo",
            state="CA",
            postal_code="94401",
            country="USA"
            )
# Identity
identity_data = Identity(
        given_name="John",
        middle_name="Smith",
        family_name="Doe",
        date_of_birth="1990-01-01",
        tax_id="666-55-4321",
        tax_id_type=TaxIdType.USA_SSN,
        country_of_citizenship="USA",
        country_of_birth="USA",
        country_of_tax_residence="USA",
        funding_source=[FundingSource.EMPLOYMENT_INCOME]
        )



# Agreements
agreement_data = [
    Agreement(
      agreement=AgreementType.MARGIN,
      signed_at="2020-09-11T18:09:33Z",
      ip_address="185.13.21.99",
    ),
    Agreement(
      agreement=AgreementType.ACCOUNT,
      signed_at="2020-09-11T18:13:44Z",
      ip_address="185.13.21.99",
    ),
    Agreement(
      agreement=AgreementType.CUSTOMER,
      signed_at="2020-09-11T18:13:44Z",
      ip_address="185.13.21.99",
    ),
    Agreement(
      agreement=AgreementType.CRYPTO,
      signed_at="2020-09-11T18:13:44Z",
      ip_address="185.13.21.99",
    )
]

# Disclosures
disclosure_data = Disclosures(
        is_control_person=False,
        is_affiliated_exchange_or_finra=False,
        is_politically_exposed=False,
        immediate_family_exposed=False,
        employment_status='employed'
        )

account_data = CreateAccountRequest(
                        contact=contact_data,
                        identity=identity_data,
                        disclosures=disclosure_data,
                        agreements=agreement_data
                        )
account = client.create_account(account_data)
print(account)

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
radzziicommented, Nov 17, 2022

thanks @sshcli i have raised to Rahul as well before

1reaction
sshclicommented, Nov 17, 2022

“value is not a valid enumeration member”

A similar issue have been solved by @OlegRa in PR https://github.com/alpacahq/alpaca-py/pull/182 Basically he just added a new OrderStatus HELD = "held" and the issue has been solved.

This was the error btw:

1 validation error for Order
legs -> 0 -> status
  value is not a valid enumeration member; permitted: 'new', 'partially_filled', 'filled', 'done_for_day', 'canceled', 'expired', 'replaced', 'pending_cancel', 'pending_replace', 'accepted', 'pending_new', 'accepted_for_bidding', 'stopped', 'rejected', 'suspended', 'calculated' (type=type_error.enum; enum_values=[<OrderStatus.NEW: 'new'>, <OrderStatus.PARTIALLY_FILLED: 'partially_filled'>, <OrderStatus.FILLED: 'filled'>, <OrderStatus.DONE_FOR_DAY: 'done_for_day'>, <OrderStatus.CANCELED: 'canceled'>, <OrderStatus.EXPIRED: 'expired'>, <OrderStatus.REPLACED: 'replaced'>, <OrderStatus.PENDING_CANCEL: 'pending_cancel'>, <OrderStatus.PENDING_REPLACE: 'pending_replace'>, <OrderStatus.ACCEPTED: 'accepted'>, <OrderStatus.PENDING_NEW: 'pending_new'>, <OrderStatus.ACCEPTED_FOR_BIDDING: 'accepted_for_bidding'>, <OrderStatus.STOPPED: 'stopped'>, <OrderStatus.REJECTED: 'rejected'>, <OrderStatus.SUSPENDED: 'suspended'>, <OrderStatus.CALCULATED: 'calculated'>])

I hope the above information helps with the troubleshooting process

Read more comments on GitHub >

github_iconTop Results From Across the Web

Account | Alpaca Docs
Open crypto and brokerage accounts, enable crypto and stock trading, and manage the ongoing user experience with Alpaca Broker API.
Read more >
4776(S, F): The computer attempted to validate the credentials ...
Describes security event 4776(S, F) The computer attempted to validate the credentials for an account.
Read more >
Anti-Enumeration and Account Testing Best Practices ... - Visa
Include IP addresses with multiple failed card payment data in a fraud detection blacklist database for manual review. • Look for excessive ...
Read more >
betfair/enums.py at master - GitHub
"this session should be created is not allowed to act(play bet) in the DKs " ... TRADING_MASTER_SUSPENDED = "Suspended Trading Master Account".
Read more >
Convert from enum ordinal to enum type - java - Stack Overflow
To convert an ordinal into its enum representation you might want to do this: ReportTypeEnum value = ReportTypeEnum.values()[ordinal];.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found