new charts
This commit is contained in:
parent
379bf1abcd
commit
c197d08d67
3 changed files with 20 additions and 0 deletions
|
@ -38,6 +38,12 @@ export interface BalanceSheet {
|
|||
total_debt: number;
|
||||
}
|
||||
|
||||
export interface Eps {
|
||||
[ticker: string]: string | number; // really just number
|
||||
quarter: string;
|
||||
|
||||
}
|
||||
|
||||
export const getCompanies = (tickers?: string[]): Promise<Company[]> =>
|
||||
fetch(BACKEND_URL + '/companies' + (tickers ? ('/' + tickers.join('/')) : ''))
|
||||
.then(r => r.json())
|
||||
|
@ -54,3 +60,7 @@ export const getPriceHistory = (tickers: string[]): Promise<PriceHistory[]> =>
|
|||
|
||||
export const getBalanceSheet = (tickers: string[]): Promise<BalanceSheet[]> =>
|
||||
fetch(BACKEND_URL + '/assets_debts/' + tickers.join('/')).then(r=>r.json())
|
||||
|
||||
|
||||
export const getEps = (tickers: string[]): Promise<Eps[]> =>
|
||||
fetch(BACKEND_URL + '/eps/' + tickers.join('/').toUpperCase()).then(r => r.json())
|
|
@ -51,6 +51,9 @@
|
|||
<v-col cols="12">
|
||||
<balance-sheet :colors="colors" :tickers="tickers" />
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<eps-chart :colors="colors" :tickers="tickers" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
@ -84,6 +87,7 @@ import { defineLoader } from '@/api/loader';
|
|||
import CompanyCard from '@/components/CompanyCard.vue';
|
||||
import EmployeesChart from '@/components/EmployeesChart.vue';
|
||||
import BalanceSheet from '@/components/BalanceSheet.vue';
|
||||
import EpsChart from '@/components/EpsChart.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
|
|
@ -9,6 +9,7 @@ import os
|
|||
import sys
|
||||
import subprocess
|
||||
from typing import Optional
|
||||
from backend.api.eps import get_eps
|
||||
|
||||
ROOT_DIR: str = os.path.dirname(__file__)
|
||||
|
||||
|
@ -57,6 +58,11 @@ def get_company_logo(ticker: str):
|
|||
return send_from_directory(ROOT_DIR, 'company_generic.svg')
|
||||
|
||||
|
||||
@app.route('/eps/<path:tickers>', methods=['GET'])
|
||||
def eps(tickers: Optional[str]) -> object:
|
||||
return jsonify(get_eps(tickers.split('/')))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2 or sys.argv[1] != 'no-frontend':
|
||||
build_frontend()
|
||||
|
|
Reference in a new issue