查詢 IEX Cloud 以尋找最新股票資料的快速方法。
探索文件 »
查看示範 · 庫存查找器錯誤 · 請求功能
我創建這個專案是為了輕鬆查詢 IEX Cloud 股票資訊資料庫供我自己使用。我最初是通過尋找已經提供此功能的軟體包來開始的,但沒有一個已更新。然後,我創建了這個包,以允許採用更簡化的方法來執行此操作。
若要開始使用此包,請按照以下步驟操作。
您需要擁有最新版本的 NPM 才能讓專案正常運作。
npm install npm@latest -g
git clone https://github.com/austinmccalley/Stock-Finder.git
npm install
tsc
以下是如何使用帶有getStock()
函數的套件對 $TSLA 股票資訊進行簡單請求的程式碼範例。
const stockFinder = require ( 'stockfinder' ) ;
/*
Declare the Stock Finder with
the parameters you want
*/
const sf = new stockFinder ( 'stable' , 'TSLA' , apiKey , false ) ;
/*
Call the get stock function and then wait
for the promise to return
*/
sf . getStock ( ) . then ( res => {
console . log ( res )
} ) ;
如果您想要取得多隻股票,您將使用getStocks()
函數。
const stockFinder = require ( 'stockfinder' ) ;
/*
Declare the Stock Finder with
the parameters you want
*/
const sf = new stockFinder ( 'stable' , [ 'TSLA' , 'AAPL' ] , apiKey , false ) ;
/*
Call the get stocks function and then wait
for the promise to return
*/
sf . getStocks ( ) . then ( res => {
console . log ( res )
} ) ;
有時,IEX Cloud 的正常要求會出現問題,您可以按照範例切換到使用 CURL 請求。
const stockFinder = require ( 'stockfinder' ) ;
/*
Declare the Stock Finder with
the parameters you want
*/
const sf = new stockFinder ( 'stable' , 'TSLA' , apiKey , true ) ;
/*
Call the get stock function and then wait
for the promise to return
*/
sf . getStock ( ) . then ( res => {
console . log ( res )
} ) ;
請參閱未決問題以取得建議功能(和已知問題)的清單。
正是貢獻使開源社群成為學習、啟發和創造的絕佳場所。我們非常感謝您所做的任何貢獻。
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)根據 MIT 許可證分發。請參閱LICENSE
以了解更多資訊。
奧斯汀·麥卡利 - [email protected]
專案連結:https://github.com/austinmccalley/Stock-Finder