import { IPricingProvider } from './pricing-provider.i'

export interface IValidPrice {
	response: string[]
	keys: [string, string][]
	signature: any
	priceParts?: IPriceOrErrorOrSkip[]
	price?: IPrice
}

export interface ISkipPrice {
	ckWd: string // node id
	noFetch: true
}

export type IPriceOrErrorOrSkip = IPriceOrError | ISkipPrice

export type IPriceOrError = IPrice | IPriceError

export type IKnownFetchPriceError =
	| 'UnknownSymbol'
	| 'OutsideMarketHours'
	| 'ProviderBusy'

export interface IPriceError {
	fetchError: boolean
	knownError?: IKnownFetchPriceError
	unknownError?: string
}

export interface IPrice {
	provider: IPricingProvider
	symbol: string
	company?: string
	globalPrice: number
	ask?: number
	bid?: number
	timestamp: number
	fromProxy?: string
	error?: string
}
