feat: 增加 基础股票代码转换

This commit is contained in:
zhangxiangliang 2020-07-21 16:53:58 +08:00
parent 34adf51126
commit f19f45723a

View File

@ -0,0 +1,61 @@
import { SZ, SH, HK, US } from "../../utils/constant";
/**
*
*/
class BaseTransform {
/**
*
*/
constructor() {}
/**
*
* @param code
*/
public SZExchangeTransform(code: string): string {
if (!code.includes(SZ)) {
throw new Error("请检查股票代码是否正确");
}
throw new Error("未实现深交所股票代码转换");
}
/**
*
* @param code
*/
public SHExchangeTransform(code: string): string {
if (!code.includes(SH)) {
throw new Error("请检查股票代码是否正确");
}
throw new Error("未实现上交所股票代码转换");
}
/**
*
* @param code
*/
public HKExchangeTransform(code: string): string {
if (!code.includes(HK)) {
throw new Error("请检查股票代码是否正确");
}
throw new Error("未实现港交所股票代码转换");
}
/**
*
* @param code
*/
public USExchangeTransform(code: string): string {
if (!code.includes(US)) {
throw new Error("请检查股票代码是否正确");
}
throw new Error("未实现美交所股票代码转换");
}
}
export default BaseTransform;