Spaces:
Sleeping
Sleeping
Download src/api.ts from TheFinAI/LetYourProfitsRun: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/TheFinAI/LetYourProfitsRun/resolve/main/src/api.ts
- Command line
-
hf download hf://spaces/TheFinAI/LetYourProfitsRun/src/api.ts
-
curl -L -o api.ts https://huggingface.co/spaces/TheFinAI/LetYourProfitsRun/resolve/main/src/api.ts
1.26 kB
| export type DataDict = Record<string, { date: string; close: number[] }[]>; | |
| export async function apiGetLatestDataset() { | |
| const r = await fetch("/api/dataset/latest"); | |
| if (!r.ok) throw new Error(await r.text()); | |
| return r.json(); | |
| } | |
| export async function apiUpsertDataset(body: { | |
| dataset_id: string; | |
| name: string; | |
| data: DataDict; | |
| assets: string[]; | |
| dates: string[]; | |
| }) { | |
| const r = await fetch("/api/dataset/upsert", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify(body), | |
| }); | |
| if (!r.ok) throw new Error(await r.text()); | |
| return r.json(); | |
| } | |
| export async function apiGetAnnotation(dataset_id: string, user_id: string) { | |
| const url = `/api/annotation/get?dataset_id=${dataset_id}&user_id=${user_id}`; | |
| const r = await fetch(url); | |
| if (!r.ok) throw new Error(await r.text()); | |
| return r.json(); | |
| } | |
| export async function apiUpsertAnnotation(body: { | |
| dataset_id: string; | |
| user_id: string; | |
| selections: any[]; | |
| step: number; | |
| window_len: number; | |
| }) { | |
| const r = await fetch("/api/annotation/upsert", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify(body), | |
| }); | |
| if (!r.ok) throw new Error(await r.text()); | |
| return r.json(); | |
| } | |