preface

Recently I communicated with some friends who do strategy research and development, and found that most of the quantitative researchers who do not have technical background do not do source code version management. The most common scenario is to rename the original code and backup it every time there is a major change, and then create a new source file with different markup for modification and testing. One friend even had an extreme case where the trading server went down and the source code for the latest version of the policy was lost. Encounter such a friend, the author will generally try to amway version management benefits. Just recently ready to help friends sort out some version management related things, also share with you, I hope to be helpful to you.

Introduction to versioning

Basic concepts of versioning

I believe that the technical background of the readers are familiar with the version management, here is a brief introduction. Version management is the process of recording, tracking, maintaining and controlling the series of changes to the same product or system caused by partial modifications.

Advantages of versioning

  • Centralized source management, you can synchronize the latest source from different devices
  • Every change to the source code is recorded and can be traced back at any time
  • In addition to comments in the code, comments when submitting the source code help the developer get a big picture of what a change is about
  • Some version management tools also provide a rich branch management tools, very convenient

The need for versioning

  • For slightly more complex projects, it is not possible to have separate backup management for each source file
  • The source code is stored locally, and it is difficult to support multi-device cooperation
  • The source code exists both locally and in the repository, which is equivalent to having a multi-point backup. It is impossible to lose the source code unless the repository’s device and the local device are irreversibly damaged at the same time
  • Multiplayer collaboration also relies on versioning

Version log screenshot

Code comparison screenshots

Code Traceability Screenshots

Using versioning

In the past, we introduced some characteristics of version management. It is also very important to build a version library and choose a suitable version management tool. Versioning tools have gone through different periods of popularity, and the most popular of these days are Git and SVN. Git is much more flexible than SVN, supports local commits, and manages branches better, so it has been embraced by the industry. The next three ways to build a repository in this article are all based on Git.

Manage source code using a code-hosting platform

There are a number of code-hosting platforms on the Internet today that provide basic versioning capabilities and are also a repository for open source libraries.

  • GitHub is one of the most popular code hosting platforms abroad. Mainly for open source and proprietary software to provide code hosting services, only support Git as a version management tool. It is now owned by Microsoft.

    • advantage

      • Collected a large number of open source software, including some well-known open source projects
      • The user base is huge, there are a large number of users at home and abroad
      • In addition to open source projects, private libraries are also supported (up to 3 collaborators)
      • Foreign intellectual property rights protection is better, the security of the source code is relatively secure
    • disadvantage

      • Because of the particularity of the domestic network,githubServer in the United States, domestic access speed is severely limited
      • Private libraries only support collaboration of up to three people
    • The cost of

      • The direct cost for personal use is 0
      • For smooth access, you may need to purchaseVPN
  • Gitee Gitee is a code hosting platform launched by OSChina. The basic functions are basically the same as GitHub, and the version management tools supported include SVN.

    • advantage

      • Domestic server, domestic access speed is fast
      • Support direct fromgithubSynchronize open source projects, equivalent to targetinggithubSet theVPN
    • disadvantage

      • International recognition is not enough, can only be used in domestic open source circle
      • Private libraries only support up to five collaborators

Use software to build a code hosting platform

Quantitative strategy source code, compared to the software source code more concerned about the source code security issues. There are a lot of peers in the management of policy source code, will worry about their own policy source leaks. In view of such concerns, I recommend these friends can consider building a code hosting platform. Compared to the online code hosting platform, the advantages of the self-built hosting platform are obvious:

  • Absolute private
  • Completely controlled
  • There is no limit to the number of collaborators
  • Service configuration is more flexible

However, there are some disadvantages to this approach:

  • Need to own server, if it is to rent the cloud machine, the cost of at least thousands of a year
  • There are too many introduced technology stacks that most quantitative researchers do not use well

But for those who have already invested in equipment, it’s also a great option. If a friend needs to use this way to build their own version management, the author is currently used in the company is Gitblit code management, you can understand.

Use cloud disk to build local hosting platform

Both of the previous approaches are conventional, either because their security is questionable or because they are too expensive and require the introduction of an additional technology stack. The third solution I want to introduce today is to use cloud disk to build a local hosting platform.

  • Rationale There are two necessary conditions for this approach:

    • SVNandGitAll supportLocal file system-based repositoryIn simple terms, the repository can be built in a local folder
    • Real-time synchronization of cloud disk, the author used360 cloud diskWe have similar productsNuts cloudEtc.

    Based on the above two necessary conditions, you can create a local repository (SVN, Git is OK) in this article by mapping the local folder in cloud disk, create a special folder, in the time of use, just need to map the repository to the local path of cloud disk can be.

  • To build the process said without evidence, the following author to their own library as an example, to show you the process of building.

    • Buy a cloud disk that supports synchronization first (please note that the capacity is sufficient)

    • Install cloud disk synchronization software and map it to a local directory



    • Create a newSourceGitCatalog, and utilizeGitinSourceGitCreate a pure version library

    • Create a new working directory andcloneThe version library you just created



    • Create a new one in your working directoryreadme.md“And write something random

    • submitreadme.mdTo the local repository (WorkDir)

    • Push code to a remote repository (cloud disk)SourceGitDirectory)

The above is the author’s key recommended scheme, this scheme in addition to providing a complete source management, the most important point, may also be a number of quantitative practitioners concerned about one point is that the privacy and security of the source code is absolutely guaranteed. Here’s why:

  • Cloud disks are for personal use and are hard to leak
  • After the source code is pushed to the remote version repository (cloud disk), it is stored in binary form
  • Unless someone knows exactly how the user is using cloud disk and what files are in a directory on the cloud disk, in general, even getting these binaries is useless

conclusion

I believe that through the introduction of this article, you readers should have a general understanding of how to manage their own policy source code. Due to time constraints, this article does not expand on the specific uses of the various tools. If some readers are interested in the scheme recommended by the author and want to try it, they can contact the author privately if they have any questions.

WonderTrader aims to provide you with better wheels for quantitative practitioners, encapsulate technology related things in the platform, and strive to bring better strategy development experience to strategy development.

With the WonderTrader gradually more people understand, there are many friends of WonderTrader’s architecture design and source code show a very strong interest, want to have a deep understanding of the internal code details of WonderTrader. It also gives me some ideas for the details of the architecture. After thinking about it for a while, I decided to publish a series of articles in the next few weeks that will focus on the design details of the WonderTrader. The content of the article may be a bit technical, I hope that interested friends will be more supportive.

Finally, Amway WonderTrader

WonderTrader making address: https://github.com/wondertrad…

WonderTrader website address: https://wondertrader.github.io

Wtpy making address: https://github.com/wondertrad…


The market is risky, investment needs to be cautious. The above statements are only a review of historical events and do not represent views on the future, nor do they serve as any investment advice.