fix types
This commit is contained in:
parent
c88944aa80
commit
31eb0408b3
|
@ -1,6 +1,14 @@
|
||||||
import { makeApiRequest, parseResolution } from './helpers'
|
import { makeApiRequest, parseResolution } from './helpers'
|
||||||
import { subscribeOnStream, unsubscribeFromStream } from './streaming'
|
import { subscribeOnStream, unsubscribeFromStream } from './streaming'
|
||||||
import mangoStore from '@store/mangoStore'
|
import mangoStore from '@store/mangoStore'
|
||||||
|
import {
|
||||||
|
LibrarySymbolInfo,
|
||||||
|
ResolutionString,
|
||||||
|
} from '@public/charting_library/charting_library'
|
||||||
|
|
||||||
|
type SymbolInfo = LibrarySymbolInfo & {
|
||||||
|
address: string
|
||||||
|
}
|
||||||
|
|
||||||
const lastBarsCache = new Map()
|
const lastBarsCache = new Map()
|
||||||
|
|
||||||
|
@ -16,7 +24,7 @@ const configurationData = {
|
||||||
'240',
|
'240',
|
||||||
'1D',
|
'1D',
|
||||||
'1W',
|
'1W',
|
||||||
],
|
] as ResolutionString[],
|
||||||
intraday_multipliers: ['1', '3', '5', '15', '30', '60', '120', '240'],
|
intraday_multipliers: ['1', '3', '5', '15', '30', '60', '120', '240'],
|
||||||
exchanges: [],
|
exchanges: [],
|
||||||
}
|
}
|
||||||
|
@ -45,26 +53,37 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
resolveSymbol: async (
|
resolveSymbol: async (
|
||||||
symbolAddress: any,
|
symbolAddress: string,
|
||||||
onSymbolResolvedCallback: any,
|
onSymbolResolvedCallback: (symbolInfo: SymbolInfo) => void
|
||||||
_onResolveErrorCallback: any,
|
// _onResolveErrorCallback: any,
|
||||||
_extension: any
|
// _extension: any
|
||||||
) => {
|
) => {
|
||||||
console.log('[resolveSymbol]: Method call', symbolAddress)
|
console.log(
|
||||||
|
'[resolveSymbol]: Method call',
|
||||||
|
symbolAddress,
|
||||||
|
onSymbolResolvedCallback
|
||||||
|
)
|
||||||
// const symbols = await getAllSymbols()
|
// const symbols = await getAllSymbols()
|
||||||
// let symbolItem = symbols.find((item: any) => item.address === symbolAddress)
|
// let symbolItem = symbols.find((item: any) => item.address === symbolAddress)
|
||||||
// console.log('========symbols:', symbolItem, symbols)
|
// console.log('========symbols:', symbolItem, symbols)
|
||||||
let symbolItem: any
|
let symbolItem:
|
||||||
|
| {
|
||||||
|
address: string
|
||||||
|
type: string
|
||||||
|
symbol: string
|
||||||
|
}
|
||||||
|
| undefined
|
||||||
|
|
||||||
if (!symbolItem) {
|
if (!symbolItem) {
|
||||||
symbolItem = {
|
symbolItem = {
|
||||||
address: symbolAddress,
|
address: symbolAddress,
|
||||||
type: 'pair',
|
type: 'pair',
|
||||||
|
symbol: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const ticker = mangoStore.getState().selectedMarket.name
|
const ticker = mangoStore.getState().selectedMarket.name
|
||||||
|
|
||||||
const symbolInfo = {
|
const symbolInfo: SymbolInfo = {
|
||||||
address: symbolItem.address,
|
address: symbolItem.address,
|
||||||
ticker: symbolItem.address,
|
ticker: symbolItem.address,
|
||||||
name: symbolItem.symbol || symbolItem.address,
|
name: symbolItem.symbol || symbolItem.address,
|
||||||
|
@ -81,6 +100,10 @@ export default {
|
||||||
intraday_multipliers: configurationData.intraday_multipliers,
|
intraday_multipliers: configurationData.intraday_multipliers,
|
||||||
volume_precision: 2,
|
volume_precision: 2,
|
||||||
data_status: 'streaming',
|
data_status: 'streaming',
|
||||||
|
full_name: 'Mango Markets',
|
||||||
|
exchange: 'Mango',
|
||||||
|
listed_exchange: '',
|
||||||
|
format: 'price',
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[resolveSymbol]: Symbol resolved', symbolAddress)
|
console.log('[resolveSymbol]: Symbol resolved', symbolAddress)
|
||||||
|
@ -88,11 +111,21 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getBars: async (
|
getBars: async (
|
||||||
symbolInfo: any,
|
symbolInfo: SymbolInfo,
|
||||||
resolution: any,
|
resolution: string,
|
||||||
periodParams: any,
|
periodParams: {
|
||||||
onHistoryCallback: any,
|
countBack: number
|
||||||
onErrorCallback: any
|
firstDataRequest: boolean
|
||||||
|
from: number
|
||||||
|
to: number
|
||||||
|
},
|
||||||
|
onHistoryCallback: (
|
||||||
|
bars: any,
|
||||||
|
t: {
|
||||||
|
noData: boolean
|
||||||
|
}
|
||||||
|
) => void,
|
||||||
|
onErrorCallback: (e: any) => void
|
||||||
) => {
|
) => {
|
||||||
const { from, to, firstDataRequest } = periodParams
|
const { from, to, firstDataRequest } = periodParams
|
||||||
console.log('[getBars]: Method call', symbolInfo, resolution, from, to)
|
console.log('[getBars]: Method call', symbolInfo, resolution, from, to)
|
||||||
|
|
Loading…
Reference in New Issue