Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

band integrated #506

Merged
merged 29 commits into from
Oct 17, 2022
Merged

band integrated #506

merged 29 commits into from
Oct 17, 2022

Conversation

cgsingh33
Copy link
Contributor

No description provided.

x/market/types/market.go Fixed Show fixed Hide fixed
Base automatically changed from v5-upgrade-dd to feature/dev October 17, 2022 06:21
x/esm/keeper/keeper.go Outdated Show resolved Hide resolved
@vishnukumavat
Copy link
Contributor

vishnukumavat commented Oct 17, 2022

@cgsingh33 @rajrohit10

func (k Keeper) CalculateTwa(ctx sdk.Context, twa types.TimeWeightedAverage) uint64 {
	var sum uint64
	for _, price := range twa.PriceValue {
		sum += price
	}
	twa.Twa = sum / 30
	return twa.Twa
}

can you please explain why it is divided by 30 instead of len(twa.PriceValue) ?

Symbol: name,
ScriptID: 12,
Rates: price,
twa1 := markettypes.TimeWeightedAverage{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be this way, please refer fix from the liquidity module.
this causes test case failure

Symbol: name,
ScriptID: 12,
Rates: price,
twa1 := markettypes.TimeWeightedAverage{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this as well, for reference look liquidity module's change in the same PR.

Symbol: name,
ScriptID: 12,
Rates: price,
twa1 := markettypes.TimeWeightedAverage{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the liquidity module's test case fix for reference for this.

@dheerajkd30 dheerajkd30 merged commit 15ae176 into feature/dev Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants