环境:ubuntu22
g\
apt-get install -y wget
apt-get install -y vim
apt-get install -y make
apt-get install -y openssl
apt-get install -y iw
apt-get install -y usbutils
apt-get install -y v4l-utils
apt-get install -y ntfs-3g
apt-get install -y zip
apt-get install -y unzip
apt-get install -y cpio
apt-get install -y pkg-config
apt-get install -y automake
apt-get install -y gcc
apt-get install -y gimp
apt-get install -y swig
apt-get install -y libtool
apt-get install -y nasm
apt-get install -y autoconf
apt-get install -y automake
apt-get install -y git
apt-get install -y mercurial
apt-get install -y libcurl4
apt-get install -y cmake
apt-get install -y yasm
apt-get install -y chkconfig
安装PIP3
sudo apt-get install -y python3-pip
安装talib
mkdir -p /var/www/setup/talib
cd /var/www/setup/talib
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xvf ta-lib-0.4.0-src.tar.gz
cd /ta-lib
./configure --prefix=/usr/local/ta-lib
make
sudo make install
安装pip里的插件
pip3 install --upgrade SQLAlchemy
pip3 install --upgrade bokeh
pip3 install --upgrade tornado
pip3 install --upgrade akshare
pip3 install --upgrade TA_Lib
pip3 install --upgrade pandas
pip3 install --upgrade APScheduler
pip3 install --upgrade numpy
pip3 install --upgrade pytz
pip3 install --upgrade pymysql
pip3 install --upgrade pipreqs
安装mysql数据库
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
修改数据库密码
1.修改配置文件:进入/etc/mysql/mysql.conf.d/ ,
在配置文件mysqld.cnf下添加 skip-grant-tables
2.在终端输入命令:sudo service mysql restart来重新启动mysql服务
3.输入:mysql -u root -p,回车进入mysql(此时不需要密码即可直接进入)
use mysql;
update user set authentication_string='' where user='root';,
alter user 'root'@'localhost' identified by '123456';
FLUSH PRIVILEGES;
alter user 'root'@'localhost' identified by '123456';
select user,plugin from mysql.user;
update user set plugin='mysql_native_password' where user='root';
FLUSH PRIVILEGES;
alter user 'root'@'localhost' identified by '123456';
FLUSH PRIVILEGES;
5.将第一步的skip-grant-tables注释掉;
6.输入service mysql restart重启mysql
安装git
sudo apt-get install git
sudo apt-get install -y git
mkdir -p /var/www/develop/InStock
cd /var/www/develop/InStock
git clone https://github.com/myhhub/InStock.git
修改目录 下 \instock\lib\database.py 数据库连接这符文件
db_host = "localhost" # 数据库服务主机
db_user = "root" # 数据库访问用户
db_password = "root" # 数据库访问密码
db_database = "instockdb" # 数据库名称
db_port = 3306 # 数据库服务端口
db_charset = "utf8mb4" # 数据库字符集
初始货数据库,生成instock数据库与对应的表
python3 /var/www/develop/InStock/instock/job/init_job.py
获取上一交易日的数据
python3 /var/www/develop/InStock/instock/job/execute_daily_job.py
启动web服务器
python3 /var/www/develop/InStock/instock/web/main.py
浏览器输入 http://localhost:9999
查看 某一股票的数据