Skip to content

Commit

Permalink
Merge pull request #1627 from JoscelynFarr/master
Browse files Browse the repository at this point in the history
add fee in JOJO
  • Loading branch information
dtmkeng committed Jul 2, 2024
2 parents ca98f90 + aa92184 commit 0a2eb8d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions fees/jojo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { FetchOptions, SimpleAdapter, FetchV2, FetchResultV2 } from '../../adapters/types'
import { httpGet } from '../../utils/fetchURL'

interface IFees {
day: string
fee: string
}

const getFetch: FetchV2 = async (options: FetchOptions): Promise<FetchResultV2> => {
const url = 'https://api.base-mainnet.jojo.exchange/v1/private/tradingFee?limit=365'
const dateStr = new Date((options.startOfDay - 86400) * 1000).toISOString().split('T')[0]
const res = await httpGet(url)
delete res['latestTen']
const item: IFees[] = Object.values(res)
const dailyFees = item.flat().find((i) => i.day.split('T')[0] === dateStr)?.fee
return {
dailyFees: dailyFees ? dailyFees : undefined,
}
}

const adapter: SimpleAdapter = {
version: 2,
adapter: {
"jojo": {
fetch: getFetch,
start: 1712678400,
}
}
}

export default adapter

0 comments on commit 0a2eb8d

Please sign in to comment.