示例#1
0
PATH = "/home/hopper/chromedriver"

# stocks = ['AMC', 'AMD', 'AMZN', 'BABA', 'BB', 'BSIG', 'CFII', 'CVX', 'DAL', 'EPD', 'ETSY', 'FB', 'GOOGL', 'KO', 'LAC', 'MSFT', 'NIO', 'NTDOY', 'NVDA', 'POWW', 'QQQ', 'RCL', 'RTX', 'SNDL', 'SPY', 'SQ', 'TEVA']
# Stopped at EPD

holdingsFile = open("holdings.py", "a")
holdingsFile.write(str(my_stocks))
holdingsFile.close()

soldFile = open("sold.py", "a")

soldStocks = []

for stock, data in my_stocks.items():
    # for stock in stocks:
    driver = webdriver.Chrome(PATH)
    driver.get('https://financhill.com/search/stock-score/' + stock)
    time.sleep(2)

    print(stock)

    score = int(driver.find_element_by_tag_name('h2').text)
    print(score)

    if (score < 40):
        r.order_sell_trailing_stop(stock, data['quantity'], 1)
        soldStocks.append(stock)

    driver.quit()
soldFile.write(soldStocks)
soldFile.close()
示例#2
0
    async def run(self):
        r.login(os.getenv('ROBINHOOD_USERNAME'),
                os.getenv('ROBINHOOD_PASSWORD'))
        limit_price, stop_price, quantity, amountInDollars = 1.0, 1.0, 1, 1.0
        buy_sell = 'N/A'
        if '$order ' in self.content:
            stock = self.content.replace('$order ', '').upper().split()
            symbol, quantity, buy_sell, limit_price, stop_price, timeout_code = stock
            confirmation = r.order(str(symbol), int(quantity),
                                   (str(buy_sell)).lower(), float(limit_price),
                                   float(stop_price),
                                   (str(timeout_code)).lower())

        elif '$order_buy_market ' in self.content:
            stock = self.content.replace('$order_buy_market ',
                                         '').upper().split()
            symbol, quantity, timeout_code = stock
            confirmation = r.order_buy_market(str(symbol), int(quantity),
                                              str(timeout_code).lower())

        elif '$order_sell_market ' in self.content:
            stock = self.content.replace('$order_sell_market ',
                                         '').upper().split()
            symbol, quantity, buy_sell, limit_price, stop_price, timeout_code = stock
            confirmation = r.order_sell_market(str(symbol), int(quantity),
                                               str(timeout_code).lower())

        elif '$order_buy_limit ' in self.content:
            stock = self.content.replace('$order_buy_limit ',
                                         '').upper().split()
            symbol, quantity, limit_price, timeout_code = stock
            confirmation = r.order_buy_limit(str(symbol), int(quantity),
                                             float(limit_price),
                                             str(timeout_code).lower())

        elif '$order_sell_limit ' in self.content:
            stock = self.content.replace('$order_sell_limit ',
                                         '').upper().split()
            symbol, quantity, limit_price, timeout_code = stock
            confirmation = r.order_sell_limit(str(symbol), int(quantity),
                                              float(limit_price),
                                              str(timeout_code).lower())

        elif '$order_buy_stop_loss ' in self.content:
            stock = self.content.replace('$order_buy_stop_loss ',
                                         '').upper().split()
            symbol, quantity, stop_price, timeout_code = stock
            confirmation = r.order_buy_stop_loss(str(symbol), int(quantity),
                                                 float(stop_price),
                                                 str(timeout_code).lower())

        elif '$order_sell_stop_loss ' in self.content:
            stock = self.content.replace('$order_sell_stop_loss ',
                                         '').upper().split()
            symbol, quantity, stop_price, timeout_code = stock
            confirmation = r.order_sell_stop_loss(str(symbol), int(quantity),
                                                  float(stop_price),
                                                  str(timeout_code).lower())

        elif '$order_buy_trailing_stop ' in self.content:
            stock = self.content.replace('$order_buy_trailing_stop ',
                                         '').upper().split()
            symbol, quantity, trailAmount, trailType, timeout_code = stock
            confirmation = r.order_buy_trailing_stop(str(symbol),
                                                     int(quantity),
                                                     float(trailAmount),
                                                     (str(trailType)).lower(),
                                                     str(timeout_code).lower())

        elif '$order_sell_trailing_stop ' in self.content:
            stock = self.content.replace('$order_sell_trailing_stop ',
                                         '').upper().split()
            symbol, quantity, trailAmount, trailType, timeout_code = stock
            confirmation = r.order_sell_trailing_stop(
                str(symbol), int(quantity), float(trailAmount), str(trailType),
                str(timeout_code).lower())

        elif '$order_sell_stop_limit ' in self.content:
            stock = self.content.replace('$order_sell_stop_limit ',
                                         '').upper().split()
            symbol, quantity, limit_price, stop_price, timeout_code = stock
            confirmation = r.order_sell_stop_limit(str(symbol), int(quantity),
                                                   float(limit_price),
                                                   float(stop_price),
                                                   (str(timeout_code)).lower())

        elif '$order_buy_crypto_limit_by_price ' in self.content:
            stock = self.content.replace('$order_buy_crypto_limit_by_price ',
                                         '').upper().split()
            symbol, amountInDollars, limit_price, timeout_code = stock
            print(str(symbol), float(amountInDollars), float(limit_price),
                  (str(timeout_code)).lower())
            confirmation = r.order_buy_crypto_limit_by_price(
                str(symbol), float(amountInDollars), float(limit_price),
                (str(timeout_code)).lower())

        elif '$order_buy_crypto_by_quantity ' in self.content:
            stock = self.content.replace('$order_buy_crypto_by_quantity ',
                                         '').upper().split()
            symbol, quantity, timeout_code = stock
            confirmation = r.order_buy_crypto_by_quantity(
                str(symbol), int(quantity), (str(timeout_code)).lower())

        elif '$order_sell_crypto_limit_by_price ' in self.content:
            stock = self.content.replace('$order_sell_crypto_limit_by_price ',
                                         '').upper().split()
            symbol, amountInDollars, limit_price, timeout_code = stock
            confirmation = r.order_sell_crypto_limit_by_price(
                str(symbol), float(amountInDollars), float(limit_price),
                (str(timeout_code)).lower())

        elif 'order_sell_crypto_limit ' in self.content:
            stock = self.content.replace('$order_buy_crypto_by_quantity ',
                                         '').upper().split()
            symbol, quantity, limit_price, timeout_code = stock
            confirmation = r.order_sell_crypto_limit(
                str(symbol), int(quantity), float(limit_price),
                (str(timeout_code)).lower())
        print(confirmation)
        message = order_information(symbol, quantity, buy_sell, limit_price,
                                    stop_price, timeout_code)

        if 'id' not in confirmation:
            message = create_simple_message(
                '❌ Order Failed - Details',
                [j for i, j in confirmation.items()])

        self.response.add_response(message)

        if len(self.response.response) == 0:
            self.response.set_error_response(0)
        self.response.done = True
import pyotp

from selenium import webdriver
import time

# totp = pyotp.TOTP("My2factorAppHere").now()
# login = r.login('*****@*****.**', 'I<3linux24', mfa_code=totp)

my_stocks = holdings.stocks
# my_stocks = r.build_holdings()

PATH = "/home/hopper/chromedriver"

# stocks = ['AMC', 'AMD', 'AMZN', 'BABA', 'BB', 'BSIG', 'CFII', 'CVX', 'DAL', 'EPD', 'ETSY', 'FB', 'GOOGL', 'KO', 'LAC', 'MSFT', 'NIO', 'NTDOY', 'NVDA', 'POWW', 'QQQ', 'RCL', 'RTX', 'SNDL', 'SPY', 'SQ', 'TEVA']
# Stopped at EPD
for stock, data in my_stocks.items():
    # for stock in stocks:
    driver = webdriver.Chrome(PATH)
    driver.get('https://financhill.com/search/stock-score/' + stock)
    time.sleep(2)

    print(stock)

    score = int(driver.find_element_by_tag_name('h2').text)
    print(score)

    if (score < 40):
        r.order_sell_trailing_stop('EPD', 40, 1)

    driver.quit()
import pyotp

from selenium import webdriver
import time

# totp = pyotp.TOTP("My2factorAppHere").now()
# login = r.login('*****@*****.**', 'I<3linux24', mfa_code=totp)

my_stocks = holdings.stocks
# my_stocks = r.build_holdings()

PATH = "/home/hopper/chromedriver"

# stocks = ['AMC', 'AMD', 'AMZN', 'BABA', 'BB', 'BSIG', 'CFII', 'CVX', 'DAL', 'EPD', 'ETSY', 'FB', 'GOOGL', 'KO', 'LAC', 'MSFT', 'NIO', 'NTDOY', 'NVDA', 'POWW', 'QQQ', 'RCL', 'RTX', 'SNDL', 'SPY', 'SQ', 'TEVA']
# Stopped at EPD
for stock, data in my_stocks.items():
    # for stock in stocks:
    driver = webdriver.Chrome(PATH)
    driver.get('https://financhill.com/search/stock-score/' + stock)
    time.sleep(2)

    print(stock)

    score = int(driver.find_element_by_tag_name('h2').text)
    print(score)

    if (score < 40):
        r.order_sell_trailing_stop(stock, data, 1)

    driver.quit()
from selenium import webdriver
import time

# totp = pyotp.TOTP("My2factorAppHere").now()
# login = r.login('*****@*****.**', 'I<3linux24', mfa_code=totp)

my_stocks = holdings.stocks
# my_stocks = r.build_holdings()

PATH = "/home/hopper/chromedriver"

# stocks = ['AMC', 'AMD', 'AMZN', 'BABA', 'BB', 'BSIG', 'CFII', 'CVX', 'DAL', 'EPD', 'ETSY', 'FB', 'GOOGL', 'KO', 'LAC', 'MSFT', 'NIO', 'NTDOY', 'NVDA', 'POWW', 'QQQ', 'RCL', 'RTX', 'SNDL', 'SPY', 'SQ', 'TEVA']
# Stopped at EPD
for stock, data in my_stocks.items():
# for stock in stocks:
    driver = webdriver.Chrome(PATH)
    driver.get('https://financhill.com/search/stock-score/' + stock)
    time.sleep(2)

    print(stock)

    score = int(driver.find_element_by_tag_name('h2').text)
    print(score)

    if (score < 40):
        r.order_sell_trailing_stop(stock, 40, 1)


    driver.quit()