feat: add bond details, yields and credit ratings
This commit is contained in:
@@ -21,6 +21,8 @@ import { StructuredLogger } from '../common/logging/structured-logger.service';
|
||||
|
||||
import type {
|
||||
TbankShare,
|
||||
TbankBond,
|
||||
TbankCoupon,
|
||||
TbankCandle,
|
||||
TbankLastPrice,
|
||||
TbankFundamentals,
|
||||
@@ -306,6 +308,46 @@ export class TbankClient {
|
||||
).then((response) => response.instruments ?? []);
|
||||
}
|
||||
|
||||
findBonds(token: string, query: string): Promise<TbankBond[]> {
|
||||
return this.call<{ instruments?: TbankBond[] }>(
|
||||
token,
|
||||
this.sparseInstruments,
|
||||
'findInstrument',
|
||||
{
|
||||
query,
|
||||
instrumentKind: 'INSTRUMENT_TYPE_BOND',
|
||||
},
|
||||
).then((response) => response.instruments ?? []);
|
||||
}
|
||||
getBond(token: string, uid: string): Promise<TbankBond | null> {
|
||||
return this.call<{ instrument?: TbankBond }>(
|
||||
token,
|
||||
this.sparseInstruments,
|
||||
'bondBy',
|
||||
{
|
||||
idType: 'INSTRUMENT_ID_TYPE_UID',
|
||||
id: uid,
|
||||
},
|
||||
).then((response) => response.instrument ?? null);
|
||||
}
|
||||
getBondCoupons(
|
||||
token: string,
|
||||
uid: string,
|
||||
from: string,
|
||||
to: string,
|
||||
): Promise<TbankCoupon[]> {
|
||||
return this.call<{ events?: TbankCoupon[] }>(
|
||||
token,
|
||||
this.sparseInstruments,
|
||||
'getBondCoupons',
|
||||
{
|
||||
instrumentId: uid,
|
||||
from: { seconds: String(utcSeconds(from)) },
|
||||
to: { seconds: String(utcSeconds(to)) },
|
||||
},
|
||||
).then((response) => response.events ?? []);
|
||||
}
|
||||
|
||||
getShare(token: string, uid: string): Promise<TbankShare | null> {
|
||||
return this.call<{ instrument?: TbankShare }>(
|
||||
token,
|
||||
|
||||
Reference in New Issue
Block a user