fix: use correct graphql candle timestamp field (#1324)
This commit is contained in:
parent
2b76e7d5c8
commit
70df56f745
@ -10,7 +10,7 @@ export const generateCandles = (
|
|||||||
): CandlesQuery => {
|
): CandlesQuery => {
|
||||||
const candles: CandleFieldsFragment[] = [
|
const candles: CandleFieldsFragment[] = [
|
||||||
{
|
{
|
||||||
datetime: '2022-04-06T09:15:00Z',
|
timestamp: '1661515200000000000',
|
||||||
high: '17481092',
|
high: '17481092',
|
||||||
low: '17403651',
|
low: '17403651',
|
||||||
open: '17458833',
|
open: '17458833',
|
||||||
@ -19,7 +19,7 @@ export const generateCandles = (
|
|||||||
__typename: 'Candle',
|
__typename: 'Candle',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
datetime: '2022-04-06T09:30:00Z',
|
timestamp: '1661516100000000000',
|
||||||
high: '17491202',
|
high: '17491202',
|
||||||
low: '17361138',
|
low: '17361138',
|
||||||
open: '17446470',
|
open: '17446470',
|
||||||
@ -28,7 +28,7 @@ export const generateCandles = (
|
|||||||
__typename: 'Candle',
|
__typename: 'Candle',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
datetime: '2022-04-06T09:45:00Z',
|
timestamp: '1661517000000000000',
|
||||||
high: '17424522',
|
high: '17424522',
|
||||||
low: '17337719',
|
low: '17337719',
|
||||||
open: '17367174',
|
open: '17367174',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fragment CandleFields on Candle {
|
fragment CandleFields on Candle {
|
||||||
datetime
|
timestamp
|
||||||
high
|
high
|
||||||
low
|
low
|
||||||
open
|
open
|
||||||
|
@ -3,7 +3,7 @@ import { Schema as Types } from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type CandleFieldsFragment = { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string };
|
export type CandleFieldsFragment = { __typename?: 'Candle', timestamp: string, high: string, low: string, open: string, close: string, volume: string };
|
||||||
|
|
||||||
export type CandlesQueryVariables = Types.Exact<{
|
export type CandlesQueryVariables = Types.Exact<{
|
||||||
marketId: Types.Scalars['ID'];
|
marketId: Types.Scalars['ID'];
|
||||||
@ -12,7 +12,7 @@ export type CandlesQueryVariables = Types.Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null };
|
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', timestamp: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null };
|
||||||
|
|
||||||
export type CandlesEventsSubscriptionVariables = Types.Exact<{
|
export type CandlesEventsSubscriptionVariables = Types.Exact<{
|
||||||
marketId: Types.Scalars['ID'];
|
marketId: Types.Scalars['ID'];
|
||||||
@ -20,11 +20,11 @@ export type CandlesEventsSubscriptionVariables = Types.Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type CandlesEventsSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } };
|
export type CandlesEventsSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', timestamp: string, high: string, low: string, open: string, close: string, volume: string } };
|
||||||
|
|
||||||
export const CandleFieldsFragmentDoc = gql`
|
export const CandleFieldsFragmentDoc = gql`
|
||||||
fragment CandleFields on Candle {
|
fragment CandleFields on Candle {
|
||||||
datetime
|
timestamp
|
||||||
high
|
high
|
||||||
low
|
low
|
||||||
open
|
open
|
||||||
|
@ -199,7 +199,7 @@ function parseCandle(
|
|||||||
decimalPlaces: number
|
decimalPlaces: number
|
||||||
): Candle {
|
): Candle {
|
||||||
return {
|
return {
|
||||||
date: new Date(candle.datetime),
|
date: new Date(Number(candle.timestamp) / 1_000_000),
|
||||||
high: Number(addDecimal(candle.high, decimalPlaces)),
|
high: Number(addDecimal(candle.high, decimalPlaces)),
|
||||||
low: Number(addDecimal(candle.low, decimalPlaces)),
|
low: Number(addDecimal(candle.low, decimalPlaces)),
|
||||||
open: Number(addDecimal(candle.open, decimalPlaces)),
|
open: Number(addDecimal(candle.open, decimalPlaces)),
|
||||||
|
Loading…
Reference in New Issue
Block a user