这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Returns None if there are no sells
<b>if</b> (self.sells.is_empty()) {
<a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_none">option::none</a>()
} <b>else</b> {
<b>let</b> front_key = self.sells.front_key();
<b>let</b> (front_key, _) = self.sells.borrow_front();
<a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_some">option::some</a>(front_key.price)
}
}
Expand Down Expand Up @@ -311,8 +311,10 @@ there are o buys / sells, returns None.
<b>return</b> <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_none">option::none</a>();
};

<b>let</b> best_ask = self.sells.front_key().price;
<b>let</b> best_bid = self.buys.back_key().price;
<b>let</b> (front_key, _) = self.sells.borrow_front();
<b>let</b> best_ask = front_key.price;
<b>let</b> (back_key, _) = self.buys.borrow_back();
<b>let</b> best_bid = back_key.price;
<a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_some">option::some</a>((best_bid + best_ask) / 2)
}
</code></pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module aptos_experimental::price_time_index {
if (self.buys.is_empty()) {
option::none()
} else {
let back_key = self.buys.back_key();
let (back_key, _) = self.buys.borrow_back();
option::some(back_key.price)
}
}
Expand All @@ -93,7 +93,7 @@ module aptos_experimental::price_time_index {
if (self.sells.is_empty()) {
option::none()
} else {
let front_key = self.sells.front_key();
let (front_key, _) = self.sells.borrow_front();
option::some(front_key.price)
}
}
Expand All @@ -105,8 +105,10 @@ module aptos_experimental::price_time_index {
return option::none();
};

let best_ask = self.sells.front_key().price;
let best_bid = self.buys.back_key().price;
let (front_key, _) = self.sells.borrow_front();
let best_ask = front_key.price;
let (back_key, _) = self.buys.borrow_back();
let best_bid = back_key.price;
option::some((best_bid + best_ask) / 2)
}

Expand Down
Loading