Part type of Stock.ts file

This commit is contained in:
Bryce Bauer 2020-12-19 21:33:45 -06:00 committed by Brendan Lane
parent cff7bcf373
commit 8606424041
1 changed files with 25 additions and 0 deletions

25
src/modules/Stock.ts Normal file
View File

@ -0,0 +1,25 @@
// SpookVooper API - modules/Stock.js
// Written by Bryce Bauer - https://github.com/bluebeargreen-2
import axios from 'axios'
const ecoURL = 'https://api.spookvooper.com/eco'
class Stock {
private ticker: string
constructor (ticker) {
this.ticker = ticker.toUperCase()
}
public async getValue () {
return await new Promise((resolve, reject) => {
axios.get(`${ecoURL}/getStockValue?ticker=${this.ticker}`, {
})
.then((response) => {
resolve(response.data)
})
.catch((error) => {
reject(error)
})
})
}
}