-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add REST endpoints for stock technical API
- Loading branch information
1 parent
66f4d80
commit fb886db
Showing
7 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { RestClientRequest } from '../../client'; | ||
|
||
export interface RestStockTechnicalBbParams { | ||
symbol: string; | ||
from?: string; | ||
to?: string; | ||
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60'; | ||
period: number; | ||
} | ||
|
||
export interface RestStockTechnicalBbResponse { | ||
symbol: string; | ||
type: string; | ||
exchange: string; | ||
market: string; | ||
timeframe: string; | ||
data: Array<{ | ||
date: string; | ||
upper: number; | ||
middle: number; | ||
lower: number; | ||
}>; | ||
} | ||
|
||
export const bb = (request: RestClientRequest, params: RestStockTechnicalBbParams) => { | ||
const { symbol, ...options } = params; | ||
return request(`technical/bb/${symbol}`, options) as Promise<RestStockTechnicalBbResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { RestClientRequest } from '../../client'; | ||
|
||
export interface RestStockTechnicalKdjParams { | ||
symbol: string; | ||
from?: string; | ||
to?: string; | ||
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60'; | ||
rPeriod: number; | ||
kPeriod: number; | ||
dPeriod: number; | ||
} | ||
|
||
export interface RestStockTechnicalKdjResponse { | ||
symbol: string; | ||
type: string; | ||
exchange: string; | ||
market: string; | ||
timeframe: string; | ||
data: Array<{ | ||
date: string; | ||
k: number; | ||
d: number; | ||
j: number; | ||
}>; | ||
} | ||
|
||
export const kdj = (request: RestClientRequest, params: RestStockTechnicalKdjParams) => { | ||
const { symbol, ...options } = params; | ||
return request(`technical/kdj/${symbol}`, options) as Promise<RestStockTechnicalKdjResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { RestClientRequest } from '../../client'; | ||
|
||
export interface RestStockTechnicalMacdParams { | ||
symbol: string; | ||
from?: string; | ||
to?: string; | ||
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60'; | ||
fast: number; | ||
slow: number; | ||
signal: number; | ||
} | ||
|
||
export interface RestStockTechnicalMacdResponse { | ||
symbol: string; | ||
type: string; | ||
exchange: string; | ||
market: string; | ||
timeframe: string; | ||
data: Array<{ | ||
date: string; | ||
macdLine: number; | ||
signalLine: number; | ||
}>; | ||
} | ||
|
||
export const macd = (request: RestClientRequest, params: RestStockTechnicalMacdParams) => { | ||
const { symbol, ...options } = params; | ||
return request(`technical/macd/${symbol}`, options) as Promise<RestStockTechnicalMacdResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { RestClientRequest } from '../../client'; | ||
|
||
export interface RestStockTechnicalRsiParams { | ||
symbol: string; | ||
from?: string; | ||
to?: string; | ||
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60'; | ||
period: number; | ||
} | ||
|
||
export interface RestStockTechnicalRsiResponse { | ||
symbol: string; | ||
type: string; | ||
exchange: string; | ||
market: string; | ||
timeframe: string; | ||
data: Array<{ | ||
date: string; | ||
rsi: number; | ||
}>; | ||
} | ||
|
||
export const rsi = (request: RestClientRequest, params: RestStockTechnicalRsiParams) => { | ||
const { symbol, ...options } = params; | ||
return request(`technical/rsi/${symbol}`, options) as Promise<RestStockTechnicalRsiResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { RestClientRequest } from '../../client'; | ||
|
||
export interface RestStockTechnicalSmaParams { | ||
symbol: string; | ||
from?: string; | ||
to?: string; | ||
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60'; | ||
period: number; | ||
} | ||
|
||
export interface RestStockTechnicalSmaResponse { | ||
symbol: string; | ||
type: string; | ||
exchange: string; | ||
market: string; | ||
timeframe: string; | ||
data: Array<{ | ||
date: string; | ||
sma: number; | ||
}>; | ||
} | ||
|
||
export const sma = (request: RestClientRequest, params: RestStockTechnicalSmaParams) => { | ||
const { symbol, ...options } = params; | ||
return request(`technical/sma/${symbol}`, options) as Promise<RestStockTechnicalSmaResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters