@watsonserve/stock-base 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dao.js CHANGED
@@ -45,6 +45,14 @@ export function toDivPoints(market, nc, data) {
45
45
  new Point('Dividend').tag('nc', `${nc}.${market}`).tag('type', 'paid').tag('currency', curr).floatField('amount', amount).timestamp(paid)
46
46
  ];
47
47
  }
48
+ export function toBonusPoint(fullNc, data) {
49
+ const { ratio, ex } = data;
50
+ return new Point('Bonus')
51
+ .tag('nc', fullNc)
52
+ .tag('type', 'ex')
53
+ .floatField('radio', ratio)
54
+ .timestamp(ex);
55
+ }
48
56
  function groupBy(key, list, delKey = false) {
49
57
  return list.reduce((pre, item) => {
50
58
  const foo = item[key];
@@ -103,6 +111,7 @@ export class InfluxDAO {
103
111
  ${filters}
104
112
  |> last()
105
113
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")`;
114
+ // console.debug(fluxQuery);
106
115
  return new Promise((resolve, reject) => {
107
116
  const list = [];
108
117
  queryClient.queryRows(fluxQuery, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@watsonserve/stock-base",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
package/types/dao.d.ts CHANGED
@@ -28,6 +28,7 @@ export declare function latestDay(): string;
28
28
  export declare function toFxPoint(sgd: number, hkd: number, cny: number, timestamp: number): Point;
29
29
  export declare function toStockPoint(market: EnMarket, st: IStock, timestamp: number): Point;
30
30
  export declare function toDivPoints(market: string, nc: string, data: IDividend): Point[];
31
+ export declare function toBonusPoint(fullNc: string, data: IDividend): Point;
31
32
  export declare class InfluxDAO {
32
33
  private origin;
33
34
  private org;