Skip to content

Commit

Permalink
rm: utc conversion for prices_chart_data (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasDeco authored Jun 11, 2024
1 parent 356ce17 commit 0f81489
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/client/indexer/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ import {
orders_bool_exp,
orders_order_by,
orders_select_column,
prices_chart_data_bool_exp,
proposal_prices_chart_data_bool_exp
prices_chart_data_bool_exp
} from "./__generated__";
import { Client as GQLWebSocketClient } from "graphql-ws";
import { FutarchyMarketsRPCClient } from "../rpc/markets";
import { PriceMath } from "@metadaoproject/futarchy";
import { BN } from "@coral-xyz/anchor";
import { convertUTCToLocalDate } from "@/dates";

export class FutarchyIndexerMarketsClient implements FutarchyMarketsClient {
public openbook: FutarchyIndexerOpenbookMarketsClient;
Expand Down Expand Up @@ -380,9 +378,7 @@ export class FutarchyIndexerMarketsClient implements FutarchyMarketsClient {
const spotObservations =
data.data?.prices_chart_data?.map<SpotObservation>((d) => ({
priceUi: d.price,
// prices_chart_data.interv is stored as a timestamp without timezone
// so we convert to the client's local alignment with other date columns in the indexer
createdAt: convertUTCToLocalDate(new Date(d.interv)),
createdAt: new Date(d.interv),
quoteAmount: d.quote_amount,
baseAmount: d.base_amount
}));
Expand Down

0 comments on commit 0f81489

Please sign in to comment.