JestonBlu / RobinHood

An R interface for the RobinHood.com no commision investing site
https://jestonblu.github.io/RobinHood/
GNU Lesser General Public License v3.0
45 stars 12 forks source link

RobinHood() issues with tbl_vars #124

Closed manntam closed 3 years ago

manntam commented 3 years ago

Everytime I use the RobinHood() function I get this as an error.

Error in UseMethod("tbl_vars") : no applicable method for 'tbl_vars' applied to an object of class "logical"

I tried using the api_login() function and it works fine.. It seems to be an issue with the api_accounts() function that is being called in RobinHood(). Have you run into this issue in the past?

If you have any insight on how to fix this, let me know!

manntam commented 3 years ago

Hey I saw the other posts related to this. I tried changing my password to something extremely simple.

9 letters and 1 number -- no special characters at all. I am still getting this error though.

Do you think that it is because there is an "@" in the email?... I am not sure how to login without the email if that's the case....

Also I have 2FA enabled.

manntam commented 3 years ago

Disabling 2FA fixed the issue.

JestonBlu commented 3 years ago

So i only get that issue when i input an invalid authentication code. Otherwise it works fine. I use google authenticator. What were you using? The @ in your email address should not be an issue.

library(RobinHood)

username = "jestonblu@gmail.com"
password = "*******************"
mfa_code = "123456"

RH = RobinHood(username, password, mfa_code)
oschwery commented 3 years ago

Hi,

I'm still getting this issue, both with the CRAN and the GitHub version.

Error in UseMethod("tbl_vars") : 
  no applicable method for 'tbl_vars' applied to an object of class "logical"

As far as I can tell, my authentication code should be valid (I use Authy).

Traceback suggests that it doesn't happen in api_login, but in api_accounts, but it may as well be carried over from that one...

traceback()
17: tbl_vars_dispatch(x)
16: structure(vars, groups = group_vars, class = c("dplyr_sel_vars", 
        "character"))
15: new_sel_vars(tbl_vars_dispatch(x), group_vars(x))
14: tbl_vars(tbl)
13: tbl_at_vars(tbl, vars, .include_group_vars = .include_group_vars)
12: tbl_at_syms(.tbl, .vars, .include_group_vars = .include_group_vars)
11: manip_at(.tbl, .vars, .funs, enquo(.funs), caller_env(), .include_group_vars = TRUE, 
        ..., .caller = "mutate_at")
10: dplyr::mutate_at(., c("gold_equity_requirement", "outstanding_interest", 
        "cash_held_for_options_collateral", "uncleared_nummus_deposits", 
        "overnight_ratio", "day_trade_buying_power", "portfolio_cash", 
        "funding_hold_balance", "cash_available_for_withdrawal", 
        "unallocated_margin_cash", "sma", "cash_held_for_nummus_restrictions", 
        "start_of_day_dtbp", "day_trade_ratio", "overnight_buying_power_held_for_orders", 
        "cash_held_for_orders", "unsettled_debit", "cash_held_for_dividends", 
        "cash", "margin_limit", "start_of_day_overnight_buying_power", 
        "overnight_buying_power", "uncleared_deposits", "day_trade_buying_power_held_for_orders", 
        "unsettled_funds", "pending_deposit", "cash_available_for_withdrawal", 
        "cash_held_for_restrictions", "crypto_buying_power", "cash_pending_from_options_events", 
        "settled_amount_borrowed"), as.numeric)
9: function_list[[i]](value)
8: freduce(value, `_function_list`)
7: `_fseq`(`_lhs`)
6: eval(quote(`_fseq`(`_lhs`)), env, env)
5: eval(quote(`_fseq`(`_lhs`)), env, env)
4: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3: dta$margin_balances %>% dplyr::mutate_at(c("gold_equity_requirement", 
       "outstanding_interest", "cash_held_for_options_collateral", 
       "uncleared_nummus_deposits", "overnight_ratio", "day_trade_buying_power", 
       "portfolio_cash", "funding_hold_balance", "cash_available_for_withdrawal", 
       "unallocated_margin_cash", "sma", "cash_held_for_nummus_restrictions", 
       "start_of_day_dtbp", "day_trade_ratio", "overnight_buying_power_held_for_orders", 
       "cash_held_for_orders", "unsettled_debit", "cash_held_for_dividends", 
       "cash", "margin_limit", "start_of_day_overnight_buying_power", 
       "overnight_buying_power", "uncleared_deposits", "day_trade_buying_power_held_for_orders", 
       "unsettled_funds", "pending_deposit", "cash_available_for_withdrawal", 
       "cash_held_for_restrictions", "crypto_buying_power", "cash_pending_from_options_events", 
       "settled_amount_borrowed"), as.numeric) %>% dplyr::mutate_at(c("updated_at", 
       "created_at"), lubridate::ymd_hms) %>% dplyr::mutate_at(c("marked_pattern_day_trader_date"), 
       lubridate::ymd)
2: api_accounts(RH)
1: RobinHood("XXX@XXX", "XXXXXXXXXX", "XXXXXX")

Any thoughts?

JestonBlu commented 3 years ago

Thanks I will give this a fresh look. I use the Google authenticator app and it worked as of yesterday. I will try to use your app. Have you tried this with multiple passwords. And you are sure you have mfa enabled on RH? Probably stating the obvious but just want to be sure.

oschwery commented 3 years ago

Hi, and thanks for your prompt reply! Yeah, I just checked again to be sure, and mfa with authenticator app is enabled. I tried with my initial password and then ran into the problem with the special characters, but removing those didn't fix it (or rather, fixing the first problem led me to the second). But let me know if there's other things I should try.

Orlando


Von: Jeston @.> Gesendet: Samstag, 5. Juni 2021 19:41 An: JestonBlu/RobinHood @.> Cc: Schwery, Orlando Manuel @.>; Comment @.> Betreff: Re: [JestonBlu/RobinHood] RobinHood() issues with tbl_vars (#124)

Thanks I will give this a fresh look. I use the Google authenticator app and it worked as of yesterday. I will try to use your app. Have you tried this with multiple passwords. And you are sure you have mfa enabled on RH? Probably stating the obvious but just want to be sure.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/JestonBlu/RobinHood/issues/124#issuecomment-855310910, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACFS3VQHQUOGACWJN3EOB7LTRKY4JANCNFSM4YYQB76Q.

JestonBlu commented 3 years ago

@oschwery So i have tested on Authy and it worked fine for me so i think we can rule out the authentication app. You said you tried both with and without special characters and neither worked for you? I have tried different combinations of passwords for myself and i havent run into any trouble. If you could maybe share an old password or something that is similar to how your password is set up i could try that on my end, but i understand not wanting to share that info either. If you do want to share something along those lines you can email me directly at jestonblu@gmail.com and I will try again.

SwingBotScripts commented 2 years ago

Hello! Was a solution ever found for this? I am having the same issue now as well.

JestonBlu commented 2 years ago

I have never been able to reproduce this issue. I have tried multiple combinations of passwords on my side. The most I can tell is that it doesnt like certain combinations of special characters. I would try changing your password first and seeing if this resolves it. If you want to provide me an old password that I can try to use and test Ill be happy to do it, but I understand if its too sensitive. I have really stopped looking into this issue for the most part.

On Wed, Dec 1, 2021 at 8:29 AM SwingBotScripts @.***> wrote:

Hello! Was a solution ever found for this? I am having the same issue now as well.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JestonBlu/RobinHood/issues/124#issuecomment-983696632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPNBONZIBAI7YZ35FW67TUOYWMPANCNFSM4YYQB76Q .

SwingBotScripts commented 2 years ago

Thanks for the quick response. My password has no special characters and it has been working for months without 2FA. I tried to enable 2FA today and play with the login, and still got either a NULL or LOGICAL error.

Thinking about what changed this week...I downgraded my account from Instant Settlement to Cash in order to day trade with a smaller balance. I just read that a user on thread https://github.com/JestonBlu/RobinHood/issues/99 was having issues with margin balances being NA. This would make sense if margin trading is disabled, which is a feature of the Cash account. They apparently had to supply "fake data" for the margin_balances to resolve the issue. I am going to ask them how they did that to see if I can get my login to work. Otherwise, I will try to upgrade my account again and see if that does the trick.

JestonBlu commented 2 years ago

Okay, thats interesting. Maybe would explain why I have never been able to reproduce the issue. I have margin trading disabled and I used 2FA currently. I have tried with multiple authenticator apps as well and that doesnt seem to matter.

On Wed, Dec 1, 2021 at 10:21 AM SwingBotScripts @.***> wrote:

Thanks for the quick response. My password has no special characters and it has been working for months without 2FA. I tried to enable 2FA today and play with the login, and still got either a NULL or LOGICAL error.

Thinking about what changed this week...I downgraded my account from Instant Settlement to Cash in order to day trade with a smaller balance. I just read that a user on thread #99 https://github.com/JestonBlu/RobinHood/issues/99 was having issues with margin balances being NA. This would make sense if margin trading is disabled, which is a feature of the Cash account. They apparently had to supply "fake data" for the margin_balances to resolve the issue. I am going to ask them how they did that to see if I can get my login to work. Otherwise, I will try to upgrade my account again and see if that does the trick.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JestonBlu/RobinHood/issues/124#issuecomment-983806253, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPNBLIC3GCC5CMTMWRMITUOZDR3ANCNFSM4YYQB76Q .

SwingBotScripts commented 2 years ago

Upgrading back to Instant worked...

JestonBlu commented 2 years ago

Interesting. I'll play with that setting and see if I can figure out a fix.

On Wed, Dec 1, 2021, 10:42 AM SwingBotScripts @.***> wrote:

Upgrading back to Instant worked...

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JestonBlu/RobinHood/issues/124#issuecomment-983824555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPNBMGDCLXCOXI3NLRX23UOZGABANCNFSM4YYQB76Q .

SwingBotScripts commented 2 years ago

That would be awesome! I'm guessing the underlying table is just different if you have a Cash account. Looking forward to seeing what you find.