Monday, August 31, 2020

IBSampleApp

 https://www.interactivebrokers.com/en/index.php?f=11698

Saturday, August 29, 2020

ema

 def calc_scores(price_dfdayindex=-1):

    '''Calculate scores based on the indicator and
    return the sorted result.
    '''
    diffs = {}
    param = 10
    for symbol in price_df.columns.levels[0]:
        df = price_df[symbol]
        if len(df.close.values) <= param:
            continue
        ema = df.close.ewm(span=param).mean()[dayindex]
        last = df.close.values[dayindex]
        diff = (last - ema) / last
        diffs[symbol] = diff

    return sorted(diffs.items(), key=lambda x: x[1])


http://straightcode.net/learn/system/algo_trading

Friday, August 28, 2020

json to sql server

 https://youtu.be/lI3WiAmDvTw

 https://polygon.io/sockets

// Stocks Aggregate:
{
    "ev": "AM",             // Event Type ( A = Second Agg, AM = Minute Agg )
    "sym": "MSFT",          // Symbol Ticker
    "v": 10204,             // Tick Volume
    "av": 200304,           // Accumulated Volume ( Today )
    "op": 114.04,           // Today's official opening price
    "vw": 114.4040,         // VWAP (Volume Weighted Average Price)
    "o": 114.11,            // Tick Open Price
    "c": 114.14,            // Tick Close Price
    "h": 114.19,            // Tick High Price
    "l": 114.09,            // Tick Low Price
    "a": 114.1314,          // Tick Average / VWAP Price
    "s": 1536036818784,     // Tick Start Timestamp ( Unix MS )
    "e": 1536036818784,     // Tick End Timestamp ( Unix MS )
}

tocks Cluster

wss://socket.polygon.io/stocks

Available Channels:
T.* Trades
Q.* Quotes
A.* Aggregate ( per second )
AM.* Aggregate ( per minute )


Thursday, August 27, 2020

TD authentication

 @AMER.OAUTHAP

chromedriver

 Another way is download and unzip chromedriver and put 'chromedriver.exe' in C:\Python27\Scripts and then you need not to provide the path of driver, just

driver= webdriver.Chrome()

will work

C:\Users\greg chu\AppData\Roaming\Python\Python38\Scripts


Monday, August 17, 2020

cannot import name 'warnings' from 'matplotlib.dates'

 

cannot import name 'warnings' from 'matplotlib.dates' (C:\Users\greg chu\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\dates.py)


pip install matplotlib==3.2.2 --user
$ python
Python 2.7.6 (default, Jan 30 2014, 20:19:23) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.1.1'

import matplotlib
matplotlib.__version__
https://community.backtrader.com/topic/981/importerror-cannot-import-name-min_per_hour-when-trying-to-plot/8

Saturday, August 15, 2020