-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add candle api to coin example
docs: Add CORP headers to images
- Loading branch information
Showing
12 changed files
with
376 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useDLE } from '@data-client/react'; | ||
import { useMemo } from 'react'; | ||
import { getCandles } from 'resources/Candles'; | ||
|
||
import { formatPrice } from '../../components/formatPrice'; | ||
|
||
export default function AssetChart({ product_id }: Props) { | ||
const { data: candles, loading } = useDLE(getCandles, { product_id }); | ||
// Don't block page from loading | ||
// TODO: put correct height item here | ||
if (loading || !candles) return <span> </span>; | ||
|
||
return <span> </span>; | ||
} | ||
|
||
interface Props { | ||
product_id: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { RestEndpoint } from '@data-client/rest'; | ||
|
||
// docs: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductcandles | ||
export const getCandles = new RestEndpoint({ | ||
urlPrefix: 'https://api.exchange.coinbase.com', | ||
path: '/products/:product_id/candles', | ||
searchParams: {} as { | ||
granularity?: 60 | 300 | 900 | 3600 | 21600 | 86400; | ||
start?: string | number; | ||
end?: string | number; | ||
}, | ||
process(value: CandleTuple[]) { | ||
return value.map(candle => ({ | ||
timestamp: candle[0], | ||
price_open: candle[3], | ||
})); | ||
}, | ||
}); | ||
|
||
type CandleTuple = [ | ||
timestamp: number, | ||
price_low: number, | ||
price_high: number, | ||
price_open: number, | ||
price_close: number, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Cloudflare headers - https://developers.cloudflare.com/pages/configuration/headers/ | ||
/img/client-logo.svg | ||
Cross-Origin-Resource-Policy: cross-origin | ||
Access-Control-Allow-Origin: * | ||
Cross-Origin-Embedder-Policy: credentialless | ||
|
||
/img/cancel.svg | ||
Cross-Origin-Resource-Policy: cross-origin | ||
Access-Control-Allow-Origin: * | ||
Cross-Origin-Embedder-Policy: credentialless |
Oops, something went wrong.