Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm: utc conversion for prices_chart_data #151

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading