No-Trade-No-Life / Yuan

Yuan - Personal Investment Operating System
https://y.ntnl.io
MIT License
300 stars 38 forks source link
finance quantitative-finance trading yuan

English | 简体中文

Language TS Contributors Forks Stargazers MIT License

Discord Issues Bugs Open Bugs Closed


Logo

Yuan

Personal Investment Operating System

AI empowered, global market, serverless, cloud-native, and privacy.

Access the Yuan GUI from any device »

Read the Docs 📖 · Report Bug 🐛 · Request Feature 💡 · Join Discord

Snapshots

image

image

image

Motivation

In the early stages of our quantitative trading endeavors, after extensively searching and researching various existing quantitative trading frameworks and products, we found that none could fully meet the development and research needs of our unique trading strategies. Thus, undeterred by the challenges, we embarked on creating our own product, Yuan, driven by our specific requirements.

Our basic requirements are:

  1. Strong Privacy Security

    Quantitative model code is the core asset of users and is at risk of being stolen. Many products on the market require uploading strategy code to servers, and these products can fully evaluate and steal the code as long as they have the user's code. If the user's strategy can be grasped by potential competitors, the user will be at a disadvantage. Therefore, there are also some products on the market that allow private deployment. We have designed a local workspace for users to ensure that their privacy is protected from being stolen by anyone, including the Yuan project team. Additionally, we have completed open-source, subject to the supervision of the open-source community, and will not do anything in the code that harms the interests of users.

  2. Full Market Compatibility

    Users invest and trade in different markets. We hope that the same strategy code can be applied to different market varieties, both for historical backtesting and real-time trading, without any additional cost. We also hope that the platform product can support various types of markets. However, due to regional laws and regulations and some business restrictions, products on the market usually only support a part of the markets, forcing users to use different platforms in different markets. Through architectural design, we decouple specific market modules, not only improving software quality but also overcoming compliance obstacles, paving the way for the globalization of the product.

  3. Cross-Platform Compatibility

    We hope that our product can run without restrictions on any device on any platform, whether on desktop or mobile. After all, the market does not care about the user's situation. Users can switch to work and interact with the market at any time in any scenario.

  4. Low Cost and High Scalability

    Industry initial licensing fees often reach thousands, not to mention the high additional and maintenance costs. We believe that these costs are partly due to bundling sales to offset development costs, partly due to inefficiency, and partly due to the desire to profit. As a product aimed at individual investors rather than enterprises, we must consider the consumption ability of ordinary investors. For investors, the most important aspect of tools is cheap and durable. Whether on personal computers or server clusters, our product can run effectively. Yuan is an investment operating system designed to empower you to master your finances.

(back to top)

Why use Yuan

Powerful Web GUI

With Yuan Web GUI, you have access to a comprehensive solution for creating, testing, and managing your trading system, as well as deploying and monitoring your applications. The GUI is completely open-source and can be deployed anywhere, without an internet connection. You can easily switch between multiple environments using just one GUI, making your experience more streamlined.

We have designed the GUI with modern browsers in mind, and it integrates with the latest web technologies, such as WebWorker, FileSystemHandle, WebRTC, and more. It is highly responsive and fast, and we are constantly working to make it even better for you.

Although the GUI is currently written in Chinese, we have plans to make it internationalized, so you can use it in your native language in the future. We welcome contributions to the project's translation, so everyone can benefit from this amazing tool. You can access the GUI for free under the MIT license, without the need to install anything - simply use the GUI.

Simple language and AI assistant

If you're interested in developing a trading strategy without the need to learn a new language or DSL, the modern JavaScript/TypeScript language is an excellent option. You can use any IDE to write your code and any version control system to manage it. If you have difficulty with coding, you can seek assistance from an AI assistant by communicating your idea to it.

// It's a simple trend-tracking trading strategy that uses the SMA indicator.
import { useSMA, useSimplePositionManager } from '@libs';
export default () => {
  const { close } = useOHLC('Y', 'XAUUSD', 'PT1H');
  const ma20 = useSMA(close, 20);
  const accountInfo = useAccountInfo();
  const [targetVolume, setTargetVolume] = useSimplePositionManager(accountInfo.account_id, 'XAUUSD');
  useEffect(() => {
    const idx = close.length - 2;
    if (close[idx] > ma20[idx]) {
      setTargetVolume(1);
    } else {
      setTargetVolume(0);
    }
  }, [close.length]);
};

More examples can be found here.

Local, cloud...or hybrid!

Yuan is a hybrid-cloud software that allows you to deploy your trading system in your home or public cloud simultaneously. You can start using your home PC and then gradually switch to the public cloud as your business grows. Choosing between your home PC or the public cloud will depend on your availability, costs, privacy, and security requirements.

Extension-first Ecosystem

In Yuan, extensions are treated as first-class citizens. Many core features are built and distributed as extensions. You can use extensions to add new features, connect with more markets, and enhance your experience. You can download extensions from the community or create your own extensions to share with others.

(back to top)

Built with

TypeScript reactivex react kubernetes docker prometheus mongodb zeromq openai nginx pnpm monaco editor vite rollup ajv webrtc letsencrypt

(back to top)

Getting started (for developers) 🚀

Prerequisites: nodejs >= 18.17.0, docker for image build, and rush for mono repo management.

npm install -g @microsoft/rush

Then you can install dependencies and build projects

rush update && rush build

If you have no docker installed, you can skip the docker build by setting the environment variable CI_RUN to true.

CI_RUN=true rush build

(back to top)

Packages

Libraries

All the libraries should be independent of the platform by default. They can be used in the browser, node.js, or other platforms. And provide both ESM and CommonJS modules.

Apps

All the apps should provide an image and publish it as a npm package. You can deploy the app by docker and Kubernetes. You can find the App List and get the image. All the apps implemented the extension interface. So you can treat them as extensions.

Web UI

@yuants/ui-web, you can directly access https://y.ntnl.io to access the Yuan GUI.

The graphical user interface (GUI) is the most widely used human-computer interaction interface today. It can do everything that command-line interfaces (CLI), natural language interfaces (NUI, LUI), and other interfaces can do.

Distributions

Yuan is a powerful operating system, but it is also too low-level, primitive, and difficult to use. Only tech-savvy users can handle it, and it is not suitable for direct use by ordinary users.

For different user scenarios, it is best to provide specific distributions that are pre-configured with some features so that users can use them directly.

Below are some distributions we provide as references. You can create your own distributions based on your needs.

Creating a Distribution

The essence of a distribution is a workspace, and the essence of a workspace is a file directory and its contents. We can package the workspace into a distribution, and then users can download and unzip it to use. We recommend using the npm package management tool to manage distributions, i.e., distributions will be published to the npm repository, and users can install distributions via npm.

In the Web GUI's address parameters, we can specify installing the distribution from npm using the from_npm parameter. For example, https://y.ntnl.io?from_npm=1&scope=yuants&name=dist-origin.

URL Parameters:

// Install the latest version of the @yuants/dist-origin distribution
https://y.ntnl.io?from_npm=1&scope=yuants&name=dist-origin

// Install a specific version (0.0.2) of the @yuants/dist-origin distribution
https://y.ntnl.io?from_npm=1&scope=yuants&name=dist-origin&version=0.0.2

// Install a specific version (>=0.0.2) of the @yuants/dist-origin distribution
https://y.ntnl.io?from_npm=1&scope=yuants&name=dist-origin&version=>=0.0.2

Documents

@yuants/docs is the document of Yuan.

It's built by Docusaurus. You can find the latest documents here.

Toolkit

@yuants/tool-kit is all you need. This provides a CLI when you need to build an extension. It helps you to build a docker image, create a bundle and more. To ensure your extension is ready to use.

Vendors

Vendors include markets, exchanges, and data sources. You can access the global market through various vendors. For some legal reason, they are probably not open to everyone. But you can use them if you gain permission from the provider.

Every vendor is a gateway to connect the external service directly. Your private data including account info and market data will not be stored in Yuan Cloud Service. You can deploy the vendor in your own cloud or local machine.

(back to top)

Contributing

Contributions make the open-source community a fantastic place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open a feature request issue. Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contributors

Thanks sincerely to the contributors:

Zheng Chen
Zheng Chen

🧑‍🏫 💻 🎨 👀
Siyuan Wang
Siyuan Wang

💻 🚇
Jinhaolin
Jinhaolin

💻
Hobo Chen
Hobo Chen

🐛
Yalun Lin Hsu
Yalun Lin Hsu

💻
SakurazukaKen
SakurazukaKen

💻
Haoran Ren
Haoran Ren

💻
pruderior
pruderior

💻
playground
playground

💻

(back to top)

Contact

(back to top)

Acknowledgments 📖

  1. Yuan-Public-Workspace You can learn how to write strategy models from this repository. You can import it to your workspace from the GUI. The repository is embedded in AI with a vector database. Contribute with your examples is greatly appreciated!
  2. Yuan-Public-Data Our public data is maintained here as a repository. Free to use. Welcome to contribute if you have other data!

(back to top)

Star History

Star History Chart

(back to top)