Most scripts inside this repository are technical indicator automated trading. These scripts include various types of momentum trading, opening range breakout, reversal of support & resistance and statistical arbitrage strategies. Yet, quantitative trading is not only about technical analysis. It can refer to computational finance to exploit derivative price mismatch, pattern recognition on alternative datasets to generate alphas or low latency order execution in the market microstructure. Hence, there are a few ongoing projects inside this repository. These projects are mostly quantamental analysis on some strange ideas I come up with to beat the market (or so I thought). There is no HFT strategy simply because ultra high frequency data are very expensive to acquire (even consider platforms like Quantopian or Quandl). Additionally, please note that, all scripts are historical data backtesting/forward testing (basically via Python, not C++, maybe Julia in the near future). The assumption is that all trades are frictionless. No slippage, no surcharge, no illiquidity. Last but not least, all scripts contain a global function named main so that you can embed the scripts directly into you trading system (although too lazy to write docstring).
They are:
🔌 Modular & reusable components
📦 Environment-agnostic (backtest, sandbox, live)
🧩 Easy to plug into any strategy or workflow
🌐 Exchange-agnostic with unified interfaces
Create, share, or combine plugins for indicators, strategies, risk controls, and more — all while keeping your code clean and scalable.
import Stock
"""
This example shows how backtest over tweets
"""
class TwitterBot(Stock.Model):
def main(self, args):
while self.has_data:
self.backtester.value_account()
self.sleep('1h')
def event(self, type_: str, data: str):
# Now check if it's a tweet about Tesla
if 'tsla' in data.lower() or 'gme' in data.lower():
# Buy, sell or evaluate your portfolio
pass
if __name__ == "__main__":
exchange = Stock.Alpaca()
model = TwitterBot(exchange)
# Add the tweets json here
model.backtester.add_custom_events(Stock.data.JsonEventReader('./tweets.json'))
# Now add some underlying prices at 1 month
model.backtester.add_prices('TSLA', '1h', start_date='3/20/22', stop_date='4/15/22')
# Backtest or run live
print(model.backtest(args=None, initial_values={'USD': 10000}))
Why Stock Plugins?
Most scripts inside this repository are technical indicator automated trading. These scripts include various types of momentum trading, opening range breakout, reversal of support & resistance and statistical arbitrage strategies. Yet, quantitative trading is not only about technical analysis. It can refer to computational finance to exploit derivative price mismatch, pattern recognition on alternative datasets to generate alphas or low latency order execution in the market microstructure. Hence, there are a few ongoing projects inside this repository. These projects are mostly quantamental analysis on some strange ideas I come up with to beat the market (or so I thought). There is no HFT strategy simply because ultra high frequency data are very expensive to acquire (even consider platforms like Quantopian or Quandl). Additionally, please note that, all scripts are historical data backtesting/forward testing (basically via Python, not C++, maybe Julia in the near future). The assumption is that all trades are frictionless. No slippage, no surcharge, no illiquidity. Last but not least, all scripts contain a global function named main so that you can embed the scripts directly into you trading system (although too lazy to write docstring).
They are:
Create, share, or combine plugins for indicators, strategies, risk controls, and more — all while keeping your code clean and scalable.
v3.0发布,前端分离,项目和部署整合到一起
修改接口展示空。修改数据库脚本。 解决预测数据买和卖的脚本。 进行缩减、计算相关添加操作。 修改启动脚本、接口路径及配置。 设置分页数据。增加联合主键判断。 解决分页问题并执行查询语句。 增加日期查询方法。 进行数据搜索相关添加操作。 添加配置。修改路由地址。 解决端口映射问题及修改端口测试。 拆分前后端,用 dockerfile 构建镜像并解决前端编译问题。 修改开发者模式,解决本地开发启动问题。 增加地址。增加前端开发者模式启动。 增加每天数据跑批。进行猜工作相关添加操作。 增加日志跑数据。升级增加展示。 架构升级并使用 vue 的 ui 开发。 增加 install docker 说明。 添加 vue api。
Stock Workspace
While the Stock Platform is all about an integration to dozens of different data vendors, the interface is either Python or a CLI.
If you want an enterprise UI to visualize this datasets and use AI agents on top, you can find Stock Workspace at.
架构设计
全系使用python实现。因为都是python的类库,互相之间调用方便。 从数据抓取,数据处理,到数据展示数据运算都是python实现。
最终的数据都到前端展示出来。主要分为4个文件夹。
🛠️ Installation
erDiagram PLUGIN { string id string name string type } PLUGIN ||--o{ STRATEGY : implements STRATEGY ||--o{ INDICATOR : uses STRATEGY ||--o{ EXECUTOR : runs EXECUTOR ||--o{ MARKET_INTERFACE : interacts MARKET_INTERFACE }|--o{ EXCHANGE : connects PLUGIN ||--o{ CONFIGURATION : requires PLUGIN ||--o{ LOGGING : logsContributors
wouldn’t be without you. If we are going to disrupt financial industry, every contribution counts. Thank you for being part of this journey.