Realize watching stocks in the terminal with Nodejs
background
A while ago, when the stock market was good, I took out all my pocket money and bought a few hands. Later, I didn't want to sell it when the market was adjusted back and forth. I planned to keep it for a while.
The opening time is always coded. It is always inappropriate to use software or web pages on the computer to see the market. Because the stock interface is too obvious, other people will know at a glance that you are not doing business but are trading stocks.
So I thought of a way to display the stocks you want to watch in real-time in the console of the IDE interface. Others don't look carefully and think it is the log of the program.
final effect
Run the program in the terminal of vscode, you can see the effect of the following figure
use
This project is not intended to be published to npm, so it needs to be cloned locally before use
[email protected]:SugarTurboS/terminal-stocks.git
Then open any IDE, install the dependent package in the terminal and run
npm install
node app.js
Configuration
You can config.js
make stock-related modifications by modifying the files in the root directory
const config = {
api:'http://hq.sinajs.cn/list=',
proxy :{
used: false,
port: '',
host: '',
headerHost:''
},
stocks:['sh601118', 'sh600684']
};
api
: Configure the stock information source api, currently the Sina stock api is used by default.
proxy
: If you need to access the API outside of the country, you can configure the proxy here.
stocks
: The list of stocks to be displayed, and the corresponding stock id is passed in the array.
For more information, please jump to github: https://github.com/SugarTurboS/terminal-stocks