Replies: 3 comments
-
|
---> This is for vectorbt stock universes. And it is for backtrader, but it helps for vectorbt also. |
Beta Was this translation helpful? Give feedback.
-
def find_code () :
code_df = vbt.AQuantData.get_codes( market='KOSDAQ' )
df = []
for index in range(0, len(code_df)) :
row = code_df.iloc[index]
if (float(config['min_cap']) < row['marcap'] < float(config['max_cap'])) and (row['amount'] > 0) :
df.append(row)
|
Beta Was this translation helpful? Give feedback.
-
|
@bsjung I had a quick look at the links you shared, and they don't address the question of a dynamic universe. I am not sure if this is possible in vbt but a workaround would be to get the data for all symbols that are going to be needed. Schematically, this is universe_mask = pd.DataFrame(False, index=dates, columns=all_symbols) for date in dates: You can then use the mask for your entries and exits |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Wonder if vbt support dynamic universe and rebalance? For example, rebalance every weekend, when rebalancing, only trade top 1000 most liquid stocks.
Beta Was this translation helpful? Give feedback.
All reactions