back-testing-react 1.0.3 → 1.0.5
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/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/{types.d.ts → index.d.ts} +25 -9
- package/package.json +1 -1
- package/rollup.config.js +1 -1
- package/src/components/back-testing-map/back-testing-map.service.ts +21 -5
- package/src/components/back-testing-map/back-testing-map.tsx +2 -2
- package/src/components/back-testing-map/back-testing-map.types.ts +10 -4
- package/src/components/back-testing-storm-legend/back-testing-storm-legend.stories.tsx +56 -33
|
@@ -5,13 +5,29 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
5
5
|
interface StormPayout {
|
|
6
6
|
name: string;
|
|
7
7
|
year: number;
|
|
8
|
-
windspeedMPH: number;
|
|
9
|
-
proxyPayout: number;
|
|
10
|
-
anemometerPayout: number;
|
|
11
|
-
category: number;
|
|
12
|
-
ciacPayout: number;
|
|
13
8
|
maxRecovery: number;
|
|
14
9
|
maxRecoveryAmount: number;
|
|
10
|
+
proxy: {
|
|
11
|
+
name?: string;
|
|
12
|
+
year?: number;
|
|
13
|
+
category?: number;
|
|
14
|
+
windspeedMPH?: number;
|
|
15
|
+
proxyPayout: number;
|
|
16
|
+
};
|
|
17
|
+
anemometer: {
|
|
18
|
+
name?: string;
|
|
19
|
+
year?: number;
|
|
20
|
+
category?: number;
|
|
21
|
+
windspeedMPH?: number;
|
|
22
|
+
anemometerPayout: number;
|
|
23
|
+
};
|
|
24
|
+
ciac: {
|
|
25
|
+
name?: string;
|
|
26
|
+
year?: number;
|
|
27
|
+
category?: number;
|
|
28
|
+
windspeedMPH?: number;
|
|
29
|
+
ciacPayout: number;
|
|
30
|
+
};
|
|
15
31
|
color?: string;
|
|
16
32
|
stormTrack: {
|
|
17
33
|
NAME: string;
|
|
@@ -36,10 +52,10 @@ interface BackTestingMapProps {
|
|
|
36
52
|
} | undefined | null;
|
|
37
53
|
limit: number | undefined | null;
|
|
38
54
|
ciacRadius: number | undefined | null;
|
|
39
|
-
anemometerCode: string;
|
|
40
|
-
proxyPayouts
|
|
41
|
-
anemometerPayouts
|
|
42
|
-
ciacPayouts
|
|
55
|
+
anemometerCode: string | undefined | null;
|
|
56
|
+
proxyPayouts?: Payout[];
|
|
57
|
+
anemometerPayouts?: Payout[];
|
|
58
|
+
ciacPayouts?: Payout[];
|
|
43
59
|
includeNoNameStorms?: boolean;
|
|
44
60
|
includeZeroPayouts?: boolean;
|
|
45
61
|
onViewChange?: (view: MapView) => void;
|
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -22,13 +22,29 @@ export class AppConfig {
|
|
|
22
22
|
export interface StormPayout {
|
|
23
23
|
name: string;
|
|
24
24
|
year: number;
|
|
25
|
-
windspeedMPH: number;
|
|
26
|
-
proxyPayout: number;
|
|
27
|
-
anemometerPayout: number;
|
|
28
|
-
category: number;
|
|
29
|
-
ciacPayout: number;
|
|
30
25
|
maxRecovery: number;
|
|
31
26
|
maxRecoveryAmount: number;
|
|
27
|
+
proxy:{
|
|
28
|
+
name?: string;
|
|
29
|
+
year?: number;
|
|
30
|
+
category?: number;
|
|
31
|
+
windspeedMPH?: number;
|
|
32
|
+
proxyPayout: number;
|
|
33
|
+
},
|
|
34
|
+
anemometer:{
|
|
35
|
+
name?: string;
|
|
36
|
+
year?: number;
|
|
37
|
+
category?: number;
|
|
38
|
+
windspeedMPH?: number;
|
|
39
|
+
anemometerPayout: number;
|
|
40
|
+
},
|
|
41
|
+
ciac:{
|
|
42
|
+
name?: string;
|
|
43
|
+
year?: number;
|
|
44
|
+
category?: number;
|
|
45
|
+
windspeedMPH?: number;
|
|
46
|
+
ciacPayout: number;
|
|
47
|
+
}
|
|
32
48
|
color?: string;
|
|
33
49
|
stormTrack:{
|
|
34
50
|
NAME: string;
|
|
@@ -473,11 +473,11 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
|
|
|
473
473
|
|
|
474
474
|
useEffect(() => {
|
|
475
475
|
if(mapLoaded){
|
|
476
|
-
if(props.location && props.limit && props.proxyPayouts && props.anemometerCode && props.anemometerPayouts && props.ciacRadius && props.ciacRadius && mapInstanceRef){
|
|
476
|
+
if(props.location && props.limit && props.proxyPayouts && props.anemometerCode && props.anemometerPayouts && props.ciacRadius && props.ciacRadius && props.ciacPayouts && mapInstanceRef){
|
|
477
477
|
calculatePayouts(props.proxyPayouts, props.anemometerCode, props.anemometerPayouts, props.ciacPayouts, false, false, props.limit)
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
},[props.location, props.limit, props.proxyPayouts, props.anemometerCode, props.anemometerPayouts, props.ciacRadius, props.ciacRadius, mapInstanceRef, mapLoaded])
|
|
480
|
+
},[props.location, props.limit, props.proxyPayouts, props.anemometerCode, props.anemometerPayouts, props.ciacRadius, props.ciacPayouts, props.ciacRadius, mapInstanceRef, mapLoaded])
|
|
481
481
|
|
|
482
482
|
return(
|
|
483
483
|
<div className="map__wrapper">
|
|
@@ -15,6 +15,7 @@ export interface Shape {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface ProxyRequest {
|
|
18
|
+
enabled: boolean;
|
|
18
19
|
radius: number;
|
|
19
20
|
latitude: number | undefined;
|
|
20
21
|
longitude: number | undefined;
|
|
@@ -22,6 +23,7 @@ export interface ProxyRequest {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export interface AnemometerRequest {
|
|
26
|
+
enabled: boolean;
|
|
25
27
|
code: string
|
|
26
28
|
latitude: number | undefined;
|
|
27
29
|
longitude: number | undefined;
|
|
@@ -29,6 +31,7 @@ export interface AnemometerRequest {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export interface CIACRequest {
|
|
34
|
+
enabled: boolean;
|
|
32
35
|
includeNotNamedStorms: boolean;
|
|
33
36
|
shapes: Shape[];
|
|
34
37
|
payouts: Payout[] | undefined;
|
|
@@ -50,10 +53,10 @@ export interface BackTestingMapProps {
|
|
|
50
53
|
location: {longitude: number, latitude: number } | undefined | null,
|
|
51
54
|
limit: number | undefined | null,
|
|
52
55
|
ciacRadius: number | undefined | null,
|
|
53
|
-
anemometerCode: string,
|
|
54
|
-
proxyPayouts
|
|
55
|
-
anemometerPayouts
|
|
56
|
-
ciacPayouts
|
|
56
|
+
anemometerCode: string | undefined | null,
|
|
57
|
+
proxyPayouts?: Payout[],
|
|
58
|
+
anemometerPayouts?: Payout[],
|
|
59
|
+
ciacPayouts?: Payout[],
|
|
57
60
|
includeNoNameStorms?: boolean,
|
|
58
61
|
includeZeroPayouts?: boolean,
|
|
59
62
|
onViewChange?: (view: MapView) => void
|
|
@@ -141,6 +144,7 @@ export function randomColor(index:number): string {
|
|
|
141
144
|
export function generateProxyRequest(latLng: [number,number], radius: number, payouts: Payout[] | undefined ){
|
|
142
145
|
let coord = (latLng);
|
|
143
146
|
let proxy : ProxyRequest = {
|
|
147
|
+
enabled:true,
|
|
144
148
|
radius: radius,
|
|
145
149
|
latitude: coord[1],
|
|
146
150
|
longitude: coord[0],
|
|
@@ -152,6 +156,7 @@ export function generateProxyRequest(latLng: [number,number], radius: number, pa
|
|
|
152
156
|
export function generateAnemometerRequest(latLng: [number,number], anemometerCode:string, payouts: Payout[] | undefined){
|
|
153
157
|
let coord = (latLng);
|
|
154
158
|
let anemometer : AnemometerRequest = {
|
|
159
|
+
enabled:true,
|
|
155
160
|
code:anemometerCode,
|
|
156
161
|
latitude: coord[1],
|
|
157
162
|
longitude: coord[0],
|
|
@@ -163,6 +168,7 @@ export function generateAnemometerRequest(latLng: [number,number], anemometerCod
|
|
|
163
168
|
export function generateCIACRequest(latLng: [number,number], radius: number | undefined, includeNoNameStorms: boolean, payouts: Payout[] | undefined){
|
|
164
169
|
let coord = (latLng);
|
|
165
170
|
let ciac : CIACRequest = {
|
|
171
|
+
enabled:true,
|
|
166
172
|
shapes:[{
|
|
167
173
|
type: "__circle",
|
|
168
174
|
latitude: coord[1],
|
|
@@ -14,54 +14,69 @@ StormLegendTest.args = {stormTracks: defaultStormTracks()};
|
|
|
14
14
|
|
|
15
15
|
function defaultStormTracks(){
|
|
16
16
|
const retVal : StormPayout[] = [{
|
|
17
|
-
"name": "
|
|
17
|
+
"name": "WILMA",
|
|
18
18
|
"year": 2005,
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
19
|
+
"proxy": {
|
|
20
|
+
"name": "WILMA",
|
|
21
|
+
"year": 2005,
|
|
22
|
+
"windspeedMPH": 94.03,
|
|
23
|
+
"proxyPayout": 0.2
|
|
24
|
+
},
|
|
25
|
+
"anemometer": {
|
|
26
|
+
"anemometerPayout": 0
|
|
27
|
+
},
|
|
28
|
+
"ciac": {
|
|
29
|
+
"ciacPayout": 0
|
|
30
|
+
},
|
|
31
|
+
"maxRecovery": 0.2,
|
|
32
|
+
"maxRecoveryAmount": 200000.0,
|
|
26
33
|
"stormTrack": [
|
|
27
34
|
{
|
|
28
|
-
"NAME": "
|
|
35
|
+
"NAME": "WILMA",
|
|
29
36
|
"SEASON": 2005,
|
|
30
37
|
"USA_SSHS": -1,
|
|
31
|
-
"ISO_TIME": "2005-
|
|
32
|
-
"USA_WIND":
|
|
38
|
+
"ISO_TIME": "2005-10-15 18:00:00",
|
|
39
|
+
"USA_WIND": 25,
|
|
33
40
|
"LOCATION": {
|
|
34
41
|
"type": "Point",
|
|
35
42
|
"coordinates": [
|
|
36
|
-
-
|
|
37
|
-
|
|
43
|
+
-78.5,
|
|
44
|
+
17.6
|
|
38
45
|
]
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
]
|
|
42
49
|
},
|
|
43
50
|
{
|
|
44
|
-
"name": "
|
|
45
|
-
"year":
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
51
|
+
"name": "ANDREW",
|
|
52
|
+
"year": 1992,
|
|
53
|
+
"proxy": {
|
|
54
|
+
"proxyPayout": 0
|
|
55
|
+
},
|
|
56
|
+
"anemometer": {
|
|
57
|
+
"anemometerPayout": 0
|
|
58
|
+
},
|
|
59
|
+
"ciac": {
|
|
60
|
+
"name": "ANDREW",
|
|
61
|
+
"year": 1992,
|
|
62
|
+
"windspeedMPH": 145,
|
|
63
|
+
"category": 5,
|
|
64
|
+
"ciacPayout": 1
|
|
65
|
+
},
|
|
66
|
+
"maxRecovery": 1,
|
|
67
|
+
"maxRecoveryAmount": 1000000,
|
|
53
68
|
"stormTrack": [
|
|
54
69
|
{
|
|
55
|
-
"NAME": "
|
|
56
|
-
"SEASON":
|
|
70
|
+
"NAME": "ANDREW",
|
|
71
|
+
"SEASON": 1992,
|
|
57
72
|
"USA_SSHS": -1,
|
|
58
|
-
"ISO_TIME": "
|
|
73
|
+
"ISO_TIME": "1992-08-16 18:00:00",
|
|
59
74
|
"USA_WIND": 25,
|
|
60
75
|
"LOCATION": {
|
|
61
76
|
"type": "Point",
|
|
62
77
|
"coordinates": [
|
|
63
|
-
-
|
|
64
|
-
|
|
78
|
+
-35.5,
|
|
79
|
+
10.8
|
|
65
80
|
]
|
|
66
81
|
}
|
|
67
82
|
}
|
|
@@ -70,13 +85,21 @@ function defaultStormTracks(){
|
|
|
70
85
|
{
|
|
71
86
|
"name": "KING",
|
|
72
87
|
"year": 1950,
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
88
|
+
"proxy": {
|
|
89
|
+
"proxyPayout": 0
|
|
90
|
+
},
|
|
91
|
+
"anemometer": {
|
|
92
|
+
"anemometerPayout": 0
|
|
93
|
+
},
|
|
94
|
+
"ciac": {
|
|
95
|
+
"name": "KING",
|
|
96
|
+
"year": 1950,
|
|
97
|
+
"windspeedMPH": 115,
|
|
98
|
+
"category": 4,
|
|
99
|
+
"ciacPayout": 0.75
|
|
100
|
+
},
|
|
78
101
|
"maxRecovery": 0.75,
|
|
79
|
-
"maxRecoveryAmount":
|
|
102
|
+
"maxRecoveryAmount": 750000.0,
|
|
80
103
|
"stormTrack": [
|
|
81
104
|
{
|
|
82
105
|
"NAME": "KING",
|