Skip to content

Instantly share code, notes, and snippets.

View yongghongg's full-sized avatar
🏠
Working from home

Yonghong Tan yongghongg

🏠
Working from home
View GitHub Profile
final_result_df = pd.DataFrame()
# read from local data
for symbol in os.listdir('price_data/'):
df = pd.read_csv(f'price_data/{symbol}')
if df.empty:
continue
df.replace('', np.nan, inplace=True)
df.dropna(inplace=True)
df.ta.cdl_pattern(name="all", append=True)
Trade Win Loss Success Rate(%)
CDL_HIKKAKEMOD 1115 532 583 47.71300448430493
CDL_BREAKAWAY 169 80 89 47.337278106508876
CDL_3WHITESOLDIERS 1500 693 807 46.2
CDL_INVERTEDHAMMER 23128 10636 12492 45.98754756139744
CDL_STICKSANDWICH 3334 1526 1808 45.770845830833835
CDL_GAPSIDESIDEWHITE 4837 2189 2648 45.255323547653504
CDL_DOJISTAR 18886 8534 10352 45.18691093932013
CDL_3LINESTRIKE 1194 539 655 45.142378559463985
CDL_GRAVESTONEDOJI 22785 10228 12557 44.88918147904323
Trade Win Loss Success Rate(%)
CDL_HIKKAKEMOD 1115 532 583 47.71
CDL_BREAKAWAY 169 80 89 47.34
CDL_3WHITESOLDIERS 1500 693 807 46.20
CDL_INVERTEDHAMMER 23128 10636 12492 45.99
CDL_STICKSANDWICH 3334 1526 1808 45.77
CDL_GAPSIDESIDEWHITE 4837 2189 2648 45.26
CDL_DOJISTAR 18886 8534 10352 45.19
CDL_3LINESTRIKE 1194 539 655 45.14
CDL_GRAVESTONEDOJI 22785 10228 12557 44.89
Trade Win Loss Success Rate(%)
CDL_LONGLEGGEDDOJI 80793 35082 45711 43.42
CDL_DOJI_10_0.1 80403 34889 45514 43.39
CDL_SPINNINGTOP 75283 32560 42723 43.25
CDL_LONGLINE 73126 31280 41846 42.78
CDL_RICKSHAWMAN 72340 31637 40703 43.73
CDL_BELTHOLD 67576 29049 38527 42.99
CDL_CLOSINGMARUBOZU 65547 27911 37636 42.58
CDL_HIGHWAVE 61614 26847 34767 43.57
CDL_SHORTLINE 58618 25563 33055 43.61
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# show a list of available market
market_list = ss.market_list
market_list
'''
[{'market': 'argentina',
'abbreviation': 'ar',
'totalCount': 388,
'lastUpdated': '2022-01-10T00:00:00.000Z',
'index': [{'id': 'BCBA:IMV',
# get symbol list based on market
symbol_list_us = ss.get_symbol_list(market="US") # "us" or "america" will also work
symbol_list_us
'''
[{'symbol': 'AAPL',
'shortName': 'apple',
'longName': 'Apple Inc.',
'exchange': 'NASDAQ',
'market': 'us_market',
# get symbol list based on index
symbol_list_dow = ss.get_symbol_list(index="DJI")
symbol_list_dow
'''
[{'symbol': 'AAPL',
'shortName': 'apple',
'longName': 'Apple Inc.',
'exchange': 'NASDAQ',
'market': 'us_market',