Skip to content

Commit

Permalink
block volume less than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Aug 18, 2024
1 parent 8cc238a commit cf4fd48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dexs/ref-finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const adapter: SimpleAdapter = {
fetch: async(ts)=>{
const data = await httpGet(api)
const cleanTimestamp = getUniqStartOfTodayTimestamp(new Date(ts * 1000))
const dailyVolume = data.find((t:any)=>dateToTs(t.date) === cleanTimestamp)?.volume
if (!dailyVolume || Number(dailyVolume) < 0 || Number((dailyVolume)) > 1_000_000_000) {
throw new Error(`Invalid daily volume: ${dailyVolume}`)
}
return {
timestamp: cleanTimestamp,
dailyVolume: data.find((t:any)=>dateToTs(t.date) === cleanTimestamp)?.volume
Expand All @@ -25,4 +29,4 @@ const adapter: SimpleAdapter = {
}
};

export default adapter;
export default adapter;

0 comments on commit cf4fd48

Please sign in to comment.