57 lines
1.2 KiB
PowerShell
57 lines
1.2 KiB
PowerShell
$known_good = @{
|
|
"6A" = 1000
|
|
"6B" = 625
|
|
"6D" = 1000
|
|
"6E" = 1250
|
|
"6J" = 1250
|
|
"M6E" = 125
|
|
"NQ" = 20
|
|
"ES" = 50
|
|
"YM" = 5
|
|
"RTY" = 50
|
|
"VX" = 1000
|
|
"EMD" = 100
|
|
"GE" = 2500
|
|
"ZB" = 1000
|
|
"ZN" = 1000
|
|
"ZF" = 1000
|
|
"ZT" = 2000
|
|
"ZQ" = 4167
|
|
"SI" = 50
|
|
"YI" = 10
|
|
"GC" = 100
|
|
"HG" = 250
|
|
"CL" = 1000
|
|
"NG" = 100
|
|
"HO" = 420
|
|
"QM" = 500
|
|
"RB" = 420
|
|
"ZC" = 50
|
|
"ZS" = 50
|
|
"ZW" = 50
|
|
"LE" = 400
|
|
"HE" = 400
|
|
"ZM" = 100
|
|
"ZL" = 600
|
|
}
|
|
|
|
$cme_file_url = "ftp://ftp.cmegroup.com/pub/fprf/csv/cmeg.fut.prf.csv"
|
|
$csv_save_path = ".\cmeg.fut.prf.csv"
|
|
$output_file = ".\cpp_out.txt"
|
|
|
|
# turn off console update progress while downloading
|
|
$CurrentProgressPref = $ProgressPreference;
|
|
$ProgressPreference = "SilentlyContinue";
|
|
Invoke-WebRequest -Uri $cme_file_url -OutFile $csv_save_path
|
|
$ProgressPreference = $CurrentProgressPref
|
|
|
|
$a = Import-Csv $csv_save_path
|
|
$b = $a | select Sym, Mult | Group Sym | Sort Name
|
|
$b | % {
|
|
if ($known_good.ContainsKey($_.Group[0].Sym)) {
|
|
$cpp = $known_good[$_.Group[0].Sym]
|
|
} else {
|
|
$cpp = $_.Group[0].Mult
|
|
}
|
|
"cpp_entry {{ `n`tkey: `"{0}`"`n`tvalue: {1}`n}}" -f $_.Group[0].Sym, $cpp } `
|
|
| out-file -Encoding ascii $output_file |