ts: remove debug code
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
b57e50c75b
commit
8d86883190
|
@ -46,22 +46,6 @@ export class HealthCache {
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
static fromDto(dto) {
|
static fromDto(dto) {
|
||||||
// console.log(
|
|
||||||
JSON.stringify(
|
|
||||||
dto,
|
|
||||||
function replacer(k, v) {
|
|
||||||
// console.log(k);
|
|
||||||
console.log(v);
|
|
||||||
// if (v instanceof BN) {
|
|
||||||
// console.log(v);
|
|
||||||
// return new I80F48(v).toNumber();
|
|
||||||
// }
|
|
||||||
// return v;
|
|
||||||
},
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
// );
|
|
||||||
process.exit(0);
|
|
||||||
return new HealthCache(
|
return new HealthCache(
|
||||||
dto.tokenInfos.map((dto) => TokenInfo.fromDto(dto)),
|
dto.tokenInfos.map((dto) => TokenInfo.fromDto(dto)),
|
||||||
dto.serum3Infos.map((dto) => Serum3Info.fromDto(dto)),
|
dto.serum3Infos.map((dto) => Serum3Info.fromDto(dto)),
|
||||||
|
@ -173,7 +157,7 @@ export class HealthCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (liabs.gt(I80F48.fromNumber(0.001))) {
|
if (liabs.gt(I80F48.fromNumber(0.001))) {
|
||||||
return HUNDRED_I80F48().mul(assets.sub(liabs).div(liabs));
|
return HUNDRED_I80F48().mul(assets.sub(liabs).div(liabs));
|
||||||
} else {
|
} else {
|
||||||
return MAX_I80F48();
|
return MAX_I80F48();
|
||||||
|
|
|
@ -286,8 +286,10 @@ export class MangoAccount {
|
||||||
* PNL is defined here as spot value + serum3 open orders value + perp value - net deposits value (evaluated at native quote price at the time of the deposit/withdraw)
|
* PNL is defined here as spot value + serum3 open orders value + perp value - net deposits value (evaluated at native quote price at the time of the deposit/withdraw)
|
||||||
* spot value + serum3 open orders value + perp value is returned by getEquity (open orders values are added to spot token values implicitly)
|
* spot value + serum3 open orders value + perp value is returned by getEquity (open orders values are added to spot token values implicitly)
|
||||||
*/
|
*/
|
||||||
getPnl(): I80F48 | undefined {
|
getPnl(): I80F48 | undefined {
|
||||||
return this.getEquity()?.add((I80F48.fromI64(this.netDeposits)).mul(I80F48.fromNumber(-1)))
|
return this.getEquity()?.add(
|
||||||
|
I80F48.fromI64(this.netDeposits).mul(I80F48.fromNumber(-1)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -616,7 +616,7 @@ export class MangoClient {
|
||||||
await this.program.account.mangoAccount.fetch(mangoAccountPk),
|
await this.program.account.mangoAccount.fetch(mangoAccountPk),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getMangoAccountWithSlot(mangoAccountPk: PublicKey) {
|
public async getMangoAccountWithSlot(mangoAccountPk: PublicKey) {
|
||||||
const resp =
|
const resp =
|
||||||
await this.program.provider.connection.getAccountInfoAndContext(
|
await this.program.provider.connection.getAccountInfoAndContext(
|
||||||
|
|
Loading…
Reference in New Issue