This file contains hidden or 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
| $base = 'https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/dts' | |
| # $date = '2022-09-01' | |
| # $date = '2022-12-01' | |
| # $date = '2022-12-15' | |
| # $date = '2022-12-16' | |
| # $date = '2022-12-19' |
This file contains hidden or 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
| # $rate = 0.83 | |
| # $month = '2022-12-' | |
| # $dates = @( | |
| # '2022-11-30' | |
| # '2022-12-07' | |
| # '2022-12-14' | |
| # '2022-12-21' |
This file contains hidden or 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
| param( | |
| $symbol, | |
| $expiration, | |
| # CSR: credit-to-spread ratio | |
| $cs_csr_min = -1, | |
| $cs_short_delta_low = 0, | |
| $cs_short_delta_high = 1, | |
| $cs_csr_gt_delta = $false, | |
| $ic_spread_csr_min = 0, # minimum CSR of the spreads that go into the iron condors |
This file contains hidden or 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
| # $result_as_of_dates = Invoke-RestMethod https://markets.newyorkfed.org/api/soma/asofdates/list.json | |
| # | |
| # $result_as_of_dates.soma.asOfDates | Sort-Object | Select-Object -Last 20 | |
| # $dates = @( | |
| # '2022-11-02' | |
| # '2022-11-09' | |
| # '2022-11-16' | |
| # '2022-11-23' |
This file contains hidden or 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
| $symbol = 'META'; $expiration = '2023-02-17' | |
| # $symbol = 'UNG'; $expiration = '2023-02-24' | |
| # ---------------------------------------------------------------------- | |
| $min_csdr = 0.3 | |
| $max_csdr = 0.4 | |
| $min_volume = -1 |
This file contains hidden or 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
| $base = 'https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/dts' | |
| # $date = '2022-12-15' | |
| # | |
| # $result_raw = Invoke-RestMethod -Method Get -Uri ($base + '/dts_table_3a?filter=record_date:eq:{0}&page[number]=1&page[size]=300' -f $date) | |
| # | |
| # $result_raw.data | ft * | |
| $date = '2022-01-01' |
This file contains hidden or 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
| $base = 'https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/dts' | |
| # ---------------------------------------------------------------------- | |
| # $date = '2022-04-01' | |
| # $date = '2022-09-01' | |
| # $date = '2022-12-15' | |
| # $date = '2022-12-16' |
This file contains hidden or 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
| $date = '2022-01-01' | |
| $base = 'https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/dts' | |
| $result_federal_tax_deposits = Invoke-RestMethod -Method Get -Uri ($base + '/dts_table_2?filter=record_date:gte:{0},transaction_catg:eq:{1}&fields=record_date,transaction_today_amt&page[number]=1&page[size]=300' -f $date, "Cash FTD's Received (Table IV)") | |
| # ---------------------------------------------------------------------- | |
| $json = @{ |
This file contains hidden or 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
| $base = 'https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/dts' | |
| # $date = '2022-12-15' | |
| # | |
| # $result_raw = Invoke-RestMethod -Method Get -Uri ($base + '/dts_table_3a?filter=record_date:eq:{0}&page[number]=1&page[size]=300' -f $date) | |
| # | |
| # $result_raw.data | ft * | |
| $date = '2022-01-01' |
This file contains hidden or 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
| $date = '2022-12-15' | |
| $result = Invoke-RestMethod -Method Get -Uri ('https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/dts/dts_table_2?filter=record_date:gte:{0}' -f $date) | |
| foreach ($row in $result.data) | |
| { | |
| $row.transaction_today_amt = [decimal]$row.transaction_today_amt | |
| } |