示例#1
0
 def __init__(self):
     print('Hello and welcome to Webull Algo Trader.')
     print('Only Paper trading is supported at the moment due to experimental results.')
     print('Please login to begin and type the command \'trade\'')
     print('To see all other commands type the command \'command\'')
     self.wb = paper_webull()
     self.attempt_login(1)
     self.await_command()
示例#2
0
    def __init__(self, creds, model_file, symbols=None, use_mfa=False):
        if use_mfa:
            self.mfa_code = input('Enter MFA Code : ')
        else:
            self.mfa_code = None
        self.wb = paper_webull()
        # self.model_res = load_model(model_file)
        self.model_tf = tf.keras.models.load_model('../cs229-master/first_model/', compile=True)
        self.login_info = self.login_webull(creds)
        self.symbols = {}
        for order in self.wb.get_account()['positions']:
            self.symbols[order['ticker']['symbol']] = {"entered_trade": {'time': order['time'], 'price': order['ticker']['price']}, 'hist': pd.DataFrame()}

        if symbols is None:
            self.update_symbols()
            self.run_update_symbols = True
        else:
            self.run_update_symbols = False

        self.date = datetime.datetime.now(tz).isoformat().split('T')[0]
        self.s = sched.scheduler(time.time, time.sleep)
        self.s.enter(1, 1, self.run)
示例#3
0
def login_webull(email, token_file="token.txt"):
    #login to Webull
    wb = paper_webull()
    try:
        f = open(token_file, "r")
        login_info = json.load(f)
    except:
        print("First time login.")
        login_info = None

    #If first time save login as token
    if not login_info:
        wb.get_mfa(email)  #mobile number should be okay as well.
        code = input('Enter MFA Code : ')
        login_info = wb.login('*****@*****.**', 'my password', 'My Device',
                              code)
        f = open(token_file, "w")
        f.write(json.dumps(login_info))
        f.close()
    else:
        wb.refresh_login()
        login_info = wb.login('*****@*****.**', 'my password')

    return wb
示例#4
0
文件: gappers03.py 项目: vrmn/webull
nasdaq_list = yf.tickers_nasdaq()
# sp500_list = yf.tickers_sp500()
now = datetime.now()

# CREDENTIALS
while True:
    ap = argparse.ArgumentParser()
    ap.add_argument(
        "-a",
        "--acc",
        required=True,
        help="input type of account e.i. --acc paper  or --acc real")
    args = vars(ap.parse_args())
    if args['acc'] == 'paper':
        from webull import paper_webull
        wb = paper_webull()
        result = wb.login('*****@*****.**',
                          'Svelty+9',
                          device_name='',
                          mfa='195001')
        if result:
            print("Logged Into Paper Account")
        else:
            print("get mfa Data")
        break
    elif args['acc'] == 'cash':
        from webull import webull
        wb = webull()
        fh = open('webull_credentials.json', 'r')
        credential_data = json.load(fh)
        fh.close()
示例#5
0
def login_webull(creds):
    wb = paper_webull()
    wb.login(creds['email'], creds['password'])
    return wb