-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
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,5 @@ | ||
|||ID_BB_COMPANY|ID_BB_SECURITY|ID_CUSIP|ID_ISIN|TICKER|ID_BB_UNIQUE|CPN|MATURITY|NAME|RTG_SP|RTG_SP_WATCH|RTG_SP_NO_WATCH|RTG_SP_WATCH_DT|SP_EFF_DT|RTG_SP_LONG|RTG_SP_SHRT|RTG_SP_LONG_RATING_DT|RTG_SP_SHRT_RATING_DT | ||
03061NHE1 Mtge|0|18|700043| |03061NHE1|U103061NHE22|AMCAR|MG!!00FE61|1.278000|20050606|AMCAR 2004-1 A1|A-1+| |A-1+| |20090617| |A-1+| |20090617| | ||
055237AA2 Mtge|0|18|700080| |055237AA2|U1055237AA98|BAMT|MG!!0000E2|4.110000|20030815|BAMT 1997-A A|AAA| |AAA| |19991217|AAA| |19991217| | | ||
055237AB3 Mtge|0|18|700080| |055237AB3|U1055237AB71|BAMT|MG!!0000E4|4.120000|20030815|BAMT 1997-A B|A| |A| |19991217|A| |19991217| | | ||
096647AE4 Mtge|0|18|700112| |096647AE4|U1096647AE27|BOAT|MG!!0000E5|5.752500|19970808|BOAT 1998-A A1|A-1+| |A-1+| |19990719| |A-1+| |19990719| |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import csv | ||
|
||
def fromcsv(csvFile,bbgFile): | ||
rowCount =0 | ||
|
||
bbg = open(bbgFile,'w') | ||
|
||
#results = [] | ||
with open(csvFile, newline='') as inputfile: | ||
xs = csv.reader(inputfile) | ||
for idx, x in enumerate(xs): | ||
if (idx == 0): | ||
bbg.write("START-OF-FILE\n") | ||
bbg.write("PROGRAMNAME=getdata\n") | ||
bbg.write("DATEFORMAT=yyyymmdd\n") | ||
bbg.write("\n") | ||
bbg.write("START-OF-FILE\n") | ||
|
||
x=x[0] | ||
headers = x.split("|") | ||
for i, header in enumerate(headers): | ||
if(i>2): | ||
field = header + "\n" | ||
bbg.write(field) | ||
bbg.write("END-OF-FIELDS\n") | ||
bbg.write("\n") | ||
bbg.write("TIMESTARTED=Tue Jul 13 14:17:17 EDT 2004\n") | ||
bbg.write("START-OF-DATA\n") | ||
|
||
else: | ||
row = x[0] + "\n" | ||
bbg.write(row) | ||
rowCount+=1 | ||
|
||
if (rowCount>0): | ||
bbg.write("END-OF-DATA\n") | ||
rowCountRecord = "DATARECORDS="+str(rowCount)+"\n" | ||
bbg.write(rowCountRecord) | ||
bbg.write("TIMEFINISHED=Tue Jul 13 14:17:17 EDT 2004\n") | ||
bbg.write("END-OF-FILE\n") | ||
|
||
bbg.close() |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,24 @@ | ||
# File Utility | ||
|
||
Utilities to convert market data vendor feed files | ||
|
||
## Bloomberg | ||
|
||
### CSV -> BBG | ||
|
||
Utility for Bloomberg Back Office feed file conversion. | ||
</br> | ||
|
||
#### Input | ||
|
||
Pipe delimited CSV with first row as header. [Sample](https://github.com/deolekar/SecuMas/blob/master/Sample/inputcsv_to_bbg.csv) | ||
|
||
#### Output | ||
|
||
BBG file at specified path. | ||
|
||
```py | ||
import SecuMas | ||
|
||
SecuMas.bbgbo.fromcsv('path/to/inputcsv_to_bbg.csv','path/to/output_bbg_bo.dif') | ||
``` |
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