Code Monkey home page Code Monkey logo

betterquant's Introduction

中文版

功能更为强大的支持国内二级市场股票期货的版本 BetterQuant2 已经开发完成

github visitors Open Source Love

Better quant today, best quant tomorrow. 💪

Welcome to fork/star, your support is the greatest motivation for this project to get better and better.

Overview

  I'm looking for job opportunities recently, if you need a technical director/partner or chief architect for a quantitative hedge fund in Shanghai, China, please email: [email protected]. Of course, if you support telecommuting, It doesn't matter where the job is.

  The main functions and features of betterquant include:

  • 🔥 This is a quantitative trading system designed to support multiple accounts, multiple strategies, multiple products, and multiple hosts in parallel.
     
  • 🔥 It supports C++ and Python to write trading strategies. A few shell commands can complete the installation and deployment of the entire system.
     
  • 🔥 In the current design, only the exchange needs to provide two interfaces: order status push and order information query (in fact, as long as the field information is perfect for the two interfaces is enough), the system can help you accurately calculate accounts, strategies, sub strategies, etc. The level of pnl and fee information, the recovery of various information after the system crashes, ignores various types of exchanges or counter interfaces, only these two interfaces are required.
     
  • 🔥 The supported trading products include spot, currency-based and USD-based perpetual contracts, currency-based and USD-based delivery contracts, as well as position management and profit and loss monitoring functions for one-way mode and hedge mode positions of the above contracts.
     
  • 🔥🔥 Powerful disaster recovery function, any subsystem crash will not lead to the final data exception‼ ️. If the trading service crashes, positions and PNL information will be rebuilt after restarting. After the trading gateway crashes and restarts, it will automatically process the status changes of unprocessed orders generated during the crash. After the risk control subsystem crashes and restarts, various risk control indicators will also be restored. The recovery process described above does not require cancel any open orders.
     
  • 🔥 All subsystems, including market data subsystem, strategy engine, trade service, trade gateway, and risk control subsystem interact through shared memory with no lock❕. Using shared memory as the ipc between subsystems enables the system to have both single-process performance and multi-process security, that is, any system crash will not cause other subsystems to crash. Of course, although the subsystems currently interact through shared memory, this is not a stand-alone trading system❕. In the future, a web service will be set up to provide restful and websocket interfaces to accept remote orders other business functions.
     
  • 🔥 Each subsystem has its own independent PUB_CHANNEL. You can publish TOPIC to your own PUB_CHANNEL. For example, the market data subsystem can publish the online of new contracts, the changes of contract parameters, and the risk control subsystem can customize its own risk control indicators and publish them to the PUB_CHANNEL of the risk control system. Each subsystem can subscribe and publish the topics they are interested in through the unified format of the system‼ ️.
     
  • 🔥 Independent position and order management functions at all levels such as account, strategy, sub-strategy, and user.
     
  • 🔥 After many systems receive orders, they will perform risk control processing for the orders. This step has become the bottleneck of these systems. By default, the system divides the received orders according to the account dimension, realizing parallel risk control processing with no lock. Make this link unimpeded✈️, of course, you can also slightly modify the code or add configuration items later, and achieve more fine-grained dimension request shunting according to the configuration specified parameters.
     
  • 🔥🔥 Plug-in risk control indicator management🔌, you can write risk control indicators in the form of dynamic link libraries according to the unified format of the system. You can enable, disable or upgrade these risk control plugins during the operation of the trading system‼ ️, so as to realize the dynamic management of risk control indicators and meet the needs of 7*24-hour trading. The open api interface allows you to get any data you want in the risk control indicator interface. Use these data to customize flexible and diversified risk control indicators based on your own needs.
     
  • 🔥🔥 Powerful pnl real-time monitoring function‼ ️, you can subscribe and monitor the realized profit and loss, unrealized profit and loss of each dimension such as account, strategy, sub-strategy, user, market, target, long position, short position and so on in any subsystem in real time, usage of fees. In other words, the realized profit and loss, unrealized profit and loss, and fee usage denominated in any currency with any combination of dimensions‼ ️, for example:

      🌶️ To subscribe and monitor the pnl and fees of BTC-denominated ETH perpetual contracts with strategy number 10000 on Binance:
    // sub
    getStgEng()->sub(stgInstInfo->stgInstId_,
                     "shm://RISK.PubChannel.Trade/PosInfo/StgId/10000");
    // on callback                     
    const auto queryCond = "stgId=10000&marketCode=Binance&symbolCode=ETH-USD-CPerp";
    const auto [statusCode, pnl] =
        posSnapshot->queryPnl(queryCond, QuoteCurrencyForCalc("BTC"));

    🌶️ To subscribe and monitor pair ETH-BTC of account 10000 in Binance trading, pnl and fee denominated in BUSD:

    // sub
    getStgEng()->sub(stgInstInfo->stgInstId_,
                     "shm://RISK.PubChannel.Trade/PosInfo/AcctId/10000");
    // on callback                     
    const auto queryCond = "stgId=10000&marketCode=Binance&symbolCode=ETH-BTC";
    const auto [statusCode, pnl] =
        posSnapshot->queryPnl(queryCond, QuoteCurrencyForCalc("BUSD"));

  You can also monitor multiple strategy combinations at the same time, and calculate the realized profit and loss, unrealized profit and loss, and usage of fees of the strategy combination. Through these profit and loss data, you can even write a monitoring strategy for monitoring other strategies❕, triggering risk control Then send various flexible functions such as intervention instructions to other strategies. Of course, after adding the algorithmic trading function in the future, you can also track the profit and loss of an algorithmic order (including multiple sub orders) in real time.
 

  • 🔥 Dynamic maintenance of status codes from exchange. Since the trading system may be connected to multiple exchanges, each exchange has its own specific status code, and unknown external status will also be received during the execution of the strategy. After receiving these external states, they will be automatically included, and you can map them to the specified internal state codes during system in running, so that the policy side can correctly process the business logic of the new state codes. The whole process does not need to restart any subsystems❕.
     
  • 🔥 The symbol code table dynamic maintenance function, the system regularly detects the changes of the exchange code table, in addition to the new code online and offline, as well as some of its largest and smallest transactions and the change unit of the amount, etc., if there is a change, the local code table is updated immediately.
     
  • 🔥 Each strategy can specify sub-strategy with several sets of parameters. The sub-strategy set is managed by a thread pool. The parameters of the sub-policy can be modified and automatically updated during system in running, and sub-strategy can also be added or disabled during operation❕. This is especially important for some markets that trade on 7*24 hours.

Table of contents

🛠 BUILD

🐋 INSTALL

🧨 WARNING

⁉️ FAQ

🥔 TODO


betterquant's People

Contributors

byrnexu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

betterquant's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.