Industrial
12/05/2018, 8:35 AMexport async function createOHLCVs(market, period, ohlcvs) {
// console.log('createOHLCVs', market, period, ohlcvs.length)
const apolloClient = getApolloClient()
await Promise.all(
ohlcvs.map((oHLCV) => {
const [timestamp, open, high, low, close, volume] = oHLCV
const variables = {
close,
high,
low,
marketBase: market.base,
marketQuote: market.quote,
open,
period,
timestamp: new Date(timestamp).toISOString(),
volume,
}
return apolloClient.mutate({
mutation: createOHLCV,
variables,
})
}),
)
}
This code makes me cry 😞divyendu
12/05/2018, 8:36 AMIndustrial
12/05/2018, 8:37 AMIndustrial
12/05/2018, 8:37 AMhuv1k
12/05/2018, 8:38 AMIndustrial
12/05/2018, 8:45 AMtype OHLCV @model {
timestamp: DateTime!
marketBase: String!
marketQuote: String!
period: String!
open: Float!
high: Float!
low: Float!
close: Float!
volume: Float
}
Industrial
12/05/2018, 8:46 AMmutation upsertOHLCV(
$timestamp: DateTime!
$marketBase: String!
$marketQuote: String!
$period: String!
$open: Float!
$high: Float!
$low: Float!
$close: Float!
$volume: Float
) {
upsertOHLCV(
where: {
timestamp: $timestamp
},
create: {
timestamp: $timestamp
marketBase: $marketBase
marketQuote: $marketQuote
period: $period
open: $open
high: $high
low: $low
close: $close
volume: $volume
},
update: {
timestamp: $timestamp
marketBase: $marketBase
marketQuote: $marketQuote
period: $period
open: $open
high: $high
low: $low
close: $close
volume: $volume
}
) {
timestamp
}
}
Industrial
12/05/2018, 8:46 AMCannot query field 'upsertOHLCV' on type 'Mutation'. Did you mean 'createOHLCV', 'upsertUser', 'upsertChart', 'upsertMarket' or 'updateManyOHLCVs'? (line 2, column 3):\n upsertOHLCV(where: {timestamp: $timestamp}, create: {timestamp: $timestamp, marketBase: $marketBase, marketQuote: $marketQuote, period: $period, open: $open, high: $high, low: $low, close: $close, volume: $volume}, update: {timestamp: $timestamp, marketBase: $marketBase, marketQuote: $marketQuote, period: $period, open: $open, high: $high, low: $low, close: $close, volume: $volume}) {\n ^",
Industrial
12/05/2018, 8:46 AMIndustrial
12/05/2018, 8:47 AMhuv1k
12/05/2018, 8:47 AMIndustrial
12/05/2018, 8:47 AMIndustrial
12/05/2018, 8:47 AMIndustrial
12/05/2018, 8:48 AMhuv1k
12/05/2018, 8:48 AMIndustrial
12/05/2018, 9:02 AMIndustrial
12/05/2018, 9:02 AMIndustrial
12/05/2018, 9:02 AMIndustrial
12/05/2018, 9:03 AM