-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from stoqey/bonds
getContractDetails implemented for bonds
- Loading branch information
Showing
9 changed files
with
184 additions
and
15 deletions.
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
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 @@ | ||
import SecType from "../data/enum/sec-type"; | ||
import { Contract } from "./contract"; | ||
|
||
/** | ||
* A Bond Contract | ||
*/ | ||
export class Bond implements Contract { | ||
constructor( | ||
public symbol: string, | ||
public maturity?: string, | ||
public exchange?: string, | ||
public currency?: string, | ||
) { | ||
this.currency = this.currency ?? "USD"; | ||
} | ||
|
||
public secType = SecType.BOND; | ||
|
||
public get lastTradeDateOrContractMonth(): string { | ||
return this.maturity; | ||
} | ||
} | ||
|
||
export default Bond; |
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
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,21 @@ | ||
/** | ||
* This file describe sample contracts to be used in various tests code. | ||
*/ | ||
import { Bond, Contract, Future, Option, OptionType, Stock } from "../.."; | ||
|
||
export const sample_stock: Contract = new Stock("AAPL"); | ||
export const sample_etf: Contract = new Stock("SPY"); | ||
export const sample_future: Contract = new Future( | ||
"ES", | ||
"ESZ3", | ||
"202312", | ||
"CME", | ||
50, | ||
); | ||
export const sample_option: Contract = new Option( | ||
"AAPL", | ||
"20251219", | ||
200, | ||
OptionType.Put, | ||
); | ||
export const sample_bond: Contract = new Bond("912828C57"); |
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