alienbrett / PyAlly

Ally Invest API Module for Python3
https://alienbrett.github.io/PyAlly/
MIT License
57 stars 28 forks source link

Error with "orders()" - "Invalid literal for int() with base 10" #64

Closed mike4kz closed 1 year ago

mike4kz commented 3 years ago

Hi,

I'm not sure if it's just my account, but in my case it has letters in the account number. So, when you're trying to convert it to an "INT()" at line 283 in ally/Order/order.py", it fails with an error.

In test you specify account as all digits, however in reality it could be alpha-numeric.

I changed line 238 to just "self.account = str(account[:8]" and it works.

Sincerely,

Mike

LaikaN57 commented 3 years ago

Can you please provide an example of your account number. Like "ZZZZ-####-####" or whatever format yours is?

Mine is an 8 digit number like ######## or /[0-9]{8}/ in regex.

LaikaN57 commented 3 years ago

Ref:

  1. "INT()" at line 283 in ally/Order/order.py (actual line)
LaikaN57 commented 3 years ago

Can you please provide an example of your account number. Like "ZZZZ-####-####" or whatever format yours is?

@mike4kz bump

davidgbiggs commented 2 years ago

Getting same error — my acct number is format #ZZ##### so it broke the int() function

LaikaN57 commented 2 years ago

@davidgbiggs Just wondering, was that account a TradeKing account before Ally bought them or some other odd scenario like a corporate account or something?

davidgbiggs commented 2 years ago

@LaikaN57 No, I just opened the account in the last year.

alanoatwork commented 1 year ago

Also have this issue with a newly created account. Is there a fix coming for this?

LaikaN57 commented 1 year ago

@davidgbiggs @alanoatwork Upon first inspection of the API it seems that the API implicitly defines the account number as an integer but I want to double check with the Ally API devs.

@alanoatwork Can you send me your account number format as @davidgbiggs did just so I have another example?

Sent:

MIME-Version: 1.0
Date: Tue, 2 May 2023 07:33:24 -0700
Message-ID: <CALGp1dkf_mVBhBHU5bBs7LZgOr4F6m15ogY0fgiNgiwfnvCPRw@mail.gmail.com>
Subject: Question: Account Number Type
From: Alex Kennedy <alexzanderkennedy@gmail.com>
To: Invest API <api@invest.ally.com>
Content-Type: multipart/alternative; boundary="000000000000694b1505fab6d2bd"

--000000000000694b1505fab6d2bd
Content-Type: text/plain; charset="UTF-8"

Hello,

We are getting reports that some customers have account numbers with
letters in them, however the API seems to implicitly imply that an account
number is an integer [a]. The format is `#ZZ#####` (more info on this
account here [b]). Upon customer testing, they report that the account
number as a string with letters can be used.

What are valid account number formats? Or at least what character set is
allowed? Any info here would be helpful. Thanks in advance.

PyAlly Github Issue: https://github.com/alienbrett/PyAlly/issues/64

[a]
https://www.ally.com/api/invest/documentation/response-structure/#:~:text=%22account%22%3A%2012345678%2C
[b] https://github.com/alienbrett/PyAlly/issues/64#issuecomment-1031784857

Thank you,
Alex Kennedy
LaikaN57 commented 1 year ago

Looks like we got confirmation on this. I have redacted parts of this conversation for privacy and relevance.

[REDACTED]
From: "Bauchman, Kenneth" <[REDACTED]@invest.ally.com>
To: Alex Kennedy <alexzanderkennedy@gmail.com>
Subject: RE: **EXTERNAL** Question: Account Number Type
Date: Tue, 2 May 2023 15:16:45 +0000
Message-ID: <MW5PR16MB4595C9E1C003D9ECDAD8F7DED66F9@MW5PR16MB4595.namprd16.prod.outlook.com>
Content-Type: multipart/mixed; boundary="_004_MW5PR16MB4595C9E1C003D9ECDAD8F7DED66F9MW5PR16MB4595namp_"
MIME-Version: 1.0
[REDACTED]

--_004_MW5PR16MB4595C9E1C003D9ECDAD8F7DED66F9MW5PR16MB4595namp_
Content-Type: multipart/alternative; boundary="_000_MW5PR16MB4595C9E1C003D9ECDAD8F7DED66F9MW5PR16MB4595namp_"

--_000_MW5PR16MB4595C9E1C003D9ECDAD8F7DED66F9MW5PR16MB4595namp_
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Thanks Alex,

[REDACTED]

Related to your account number question, account numbers are 8 characters l=
ong. For those account numbers that do contain two letters, they would be f=
ound in the second and third character returned. For example, 2FGxxxxx.

Please let us know if you have any further questions.

Thank you!

ally |  Kenny Bauchman
Production Engineering Manager | Ally Invest
[REDACTED]@invest.ally.com<mailto:[REDACTED]@invest.ally.com>