Developer Guide - Loren1166/NautilusTrader- GitHub Wiki
Developer Guide | 开发者指南
Welcome to the developer guide for NautilusTrader! 欢迎使用 NautilusTrader 开发者指南!
Here you will find information related to developing and extending the NautilusTrader codebase. These guides will assist you in both adding functionality for your own trading operation, and/or acting as a guide to assist with valuable contributions. 在这里,您将找到与开发和扩展 NautilusTrader 代码库相关的信息。这些指南将帮助您为自己的交易操作添加功能,和/或作为指南来帮助您做出有价值的贡献。
We believe in using the right tool for the job. The overall design philosophy is to fully utilize the high level power of Python, with its rich eco-system of frameworks and libraries, whilst overcoming some of its inherent shortcomings in performance and lack of built-in type safety (with it being an interpreted dynamic language). 我们相信使用正确的工具来完成工作。总体设计理念是充分利用 Python 的高级功能,以及其丰富的框架和库生态系统,同时克服其在性能和缺乏内置类型安全性方面的一些固有缺点(因为它是一种解释型动态语言)。
One of the advantages of Cython is that allocation and freeing of memory is handled by the C code generator during the ‘cythonization’ step of the build (unless you’re specifically utilizing some of its lower level features). Cython 的优势之一是,在构建的“cythonization”步骤中,内存的分配和释放由 C 代码生成器处理(除非您专门使用其一些低级功能)。
So we get the best of both worlds - with Pythons clean straight forward syntax, and a lot of potential to extract several orders of magnitude greater runtime performance through compiled C dynamic libraries. 因此,我们获得了两个世界中最好的结果 - Python 简洁直接的语法,以及通过编译的 C 动态库提取几个数量级的更高运行时性能的巨大潜力。
The main development and runtime environment we are working in is of course Python. With the introduction of Cython syntax throughout the production codebase in .pyx and .pxd files - it’s important to be aware of how the CPython implementation of Python interacts with the underlying CPython API, and the NautilusTrader C extension modules which Cython produces. 我们正在使用的主要开发和运行时环境当然是 Python。随着 Cython 语法在 .pyx 和 .pxd 文件中的生产代码库中引入,重要的是要了解 Python 的 CPython 实现如何与底层 CPython API 以及 Cython 生成的 NautilusTrader C 扩展模块交互。
We recommend a thorough review of the Cython docs to familiarize yourself with some of its core concepts, and where C typing is being introduced. 我们建议您彻底阅读 Cython 文档,以熟悉其一些核心概念,以及 C 类型引入的位置。
It's not necessary to become a C language expert, however it's helpful to understand how Cython C syntax is used in function and method definitions, in local code blocks, and the common primitive C types and how these map to their corresponding PyObject types. 没有必要成为 C 语言专家,但是了解 Cython C 语法如何在函数和方法定义、本地代码块以及常见的原始 C 类型中使用,以及它们如何映射到相应的 PyObject 类型是有帮助的。
Contents | 目录
- Environment Setup | 环境设置
- Coding Standards | 编码标准
- Cython | Cython
- Rust | Rust
- Testing | 测试
- Adapters | 适配器
- Packaged Data | 打包数据