-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/cetusfinance/qwack
- Loading branch information
Showing
11 changed files
with
23,549 additions
and
10,913 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,67 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Qwack.Futures | ||
{ | ||
public static class CodeConversion | ||
{ | ||
public static string ConvertBbgToIB(this string bbg, IFutureSettingsProvider provider) | ||
{ | ||
switch (bbg.ToLower().Right(6)) | ||
{ | ||
case "comdty": | ||
if(bbg.Length<13) //its not an option | ||
{ | ||
if(bbg.Length==11 && bbg.Substring(4,1)==" ") // ccMY Comdty format | ||
{ | ||
var bbgCode = bbg.Left(2); | ||
if (provider.TryGet(bbgCode, "BBG", out var fs)) | ||
{ | ||
var monthYear = bbg.Substring(2, 2); | ||
var qCode = fs.CodeConversions["BBG"].Where(x => x.Value == bbgCode.ToUpper()).First().Key; | ||
var ibCode = fs.CodeConversions["IB"][qCode]; | ||
return $"{ibCode}{monthYear}"; | ||
} | ||
} | ||
else if (bbg.Length == 12 && bbg.Substring(5, 1) == " ") // ccMY Comdty format | ||
{ | ||
var bbgCode = bbg.Left(3); | ||
if (provider.TryGet(bbgCode, "BBG", out var fs)) | ||
{ | ||
var monthYear = bbg.Substring(3, 2); | ||
var qCode = fs.CodeConversions["BBG"].Where(x => x.Value == bbgCode.ToUpper()).First().Key; | ||
var ibCode = fs.CodeConversions["IB"][qCode]; | ||
return $"{ibCode}{monthYear}"; | ||
} | ||
} | ||
} | ||
else //its an option | ||
{ | ||
|
||
} | ||
break; | ||
case "curncy": | ||
break; | ||
case "equity": | ||
break; | ||
case " index": | ||
break; | ||
|
||
} | ||
|
||
return null; | ||
} | ||
|
||
public static string Right(this string str, int n) | ||
{ | ||
return str.Substring(str.Length - n, n); | ||
} | ||
|
||
public static string Left(this string str, int n) | ||
{ | ||
return str.Substring(0, n); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.