Skip to main content

Quant1X量化研究

Project description

正确打开Quant1X项目的方式

1. 环境配置

1.1 默认均为64位操作系统

python golang
3.12.x 1.25.x

1.2 环境安装推荐使用brew

安装brew时需要注意避免使用root权限

2. python

python的运行环境可能存在多个版本冲突的问题,那么怎么来解决多版本的共存的问题呢?使用pyenv。

2.1 安装pyenv

brew install pyenv

2.1.1 查看已安装的版本

pyenv versions

我的电脑返回以下版本信息

  system
  3.8.16
* 3.10.10 (set by /Users/wangfeng/.pyenv/version)

2.1.2 查看可安装的版本

pyenv install -l

2.1.3 安装指定版本的python, 本文指定3.12.9或3.12.x更新版本

pyenv install 3.12.9

2.1.4 pip类库管理工具

安装python完成之后, python类库管理工具pip已经默认安装完成了

2.1.5 python基础工具

工具 功能
pip 类似maven、gradle、go mod的类库管理工具
pip-autoremove 自动删除类库所有依赖库
pipreqs 项目/类库交叉依赖检测

2.1.6 pip 源配置

windows

cd ~\AppData\Roaming\pip
notepad.exe pip.ini

*nix

cd ~/.pip
vim pip.conf

输入以下内容

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

2.2 依赖库

python环境中依赖管理的配置文件为requirements.txt,类似java的maven pom.xml、golang的go.mod。

2.2.1 安装项目依赖的库

pip install -r requirements.txt

2.2.2 检测项目依赖输出到requirements.txt

pip freeze > requirements.txt

2.2.3 交叉依赖

pip install pipreqs
pipreqs ./ --encoding utf8

2.3 上传package到PyPi

2.3.1 安装或更新setuptools、wheel、twine

pip install --upgrade setuptools wheel twine

2.3.2 打包并生成tar.gz和whl文件

python setup.py sdist bdist_wheel

2.3.3 上传package到PyPi的测试环境

twine upload --repository testpypi dist/*

2.3.4 上传package到PyPi的正式环境

twine upload dist/*

2.4 Matplotlib中文乱码问题解决方案

2.4.1 编写如下代码,获取matplotlib包所在的配置文件的路径

import matplotlib
matplotlib.matplotlib_fname() #输出matplotlib包所在的配置文件的路径

2.4.2 根据上面的路径打开文件夹(根据自己实际的输出路径去操作)

我选择了SimHei中文字体, 复制到fonts/ttf/目录下

cp -r /Users/wangfeng/Library/Fonts/SimHei.ttf fonts/ttf/

2.4.3 编辑2.4.1获得路径matplotlibrc文件

2.4.3.1 找到 #font.sans-serif,去掉前面的#,并在:后面写上在准备工作加入的中文字体的名称SimHei

2.4.3.2 找到#axes.unicode_minus,去掉前面的#,并在:改为False

2.4.4 控制台切换到~/.matplotlib目录, 删除tex.cache文件和fontList.json文件

cd ~/.matplotlib
rm -rf *

3. golang

环境设定

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPRIVATE=gitee.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quant1x-0.5.8.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quant1x-0.5.8-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file quant1x-0.5.8.tar.gz.

File metadata

  • Download URL: quant1x-0.5.8.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quant1x-0.5.8.tar.gz
Algorithm Hash digest
SHA256 0acdecc59602d9c63901603b32e65aff76e3e724b10818871632f7e1aa7a8bdc
MD5 a53a9b3e3cf9ce45e79022bd7102d8ee
BLAKE2b-256 d2ec7255869c361c0855f21b8ee639d1c08869fad94861b31f3467f8e80ce6c8

See more details on using hashes here.

File details

Details for the file quant1x-0.5.8-py3-none-any.whl.

File metadata

  • Download URL: quant1x-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quant1x-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9e6b6f2e335c6cdc2877f45bf61ddbf4ec1ecc0519cb44bd6c929d9d6d18cbb3
MD5 e28e3fb251649a7ad31fd11f63c4e0f0
BLAKE2b-256 6f78fabd1bb37d36b1752a660b8fc4219870612e00b97431ec3ac8e055aca3f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page