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

return lowest_ask and highest_bid order volume #2162

Closed
wants to merge 2 commits into from
Closed
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
23 changes: 20 additions & 3 deletions libraries/app/api_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ market_ticker::market_ticker(const market_ticker_object& mto,
quote = asset_quote.symbol;
percent_change = "0";
lowest_ask = "0";
lowest_ask_base_size = "0";
lowest_ask_quote_size = "0";
highest_bid = "0";

highest_bid_base_size = "0";
highest_bid_quote_size = "0";
fc::uint128_t bv;
fc::uint128_t qv;
price latest_price = asset( mto.latest_base, mto.base ) / asset( mto.latest_quote, mto.quote );
Expand Down Expand Up @@ -68,9 +71,19 @@ market_ticker::market_ticker(const market_ticker_object& mto,
quote_volume = uint128_amount_to_string( qv, asset_quote.precision );

if(!orders.asks.empty())
abitmore marked this conversation as resolved.
Show resolved Hide resolved
lowest_ask = orders.asks[0].price;
{
lowest_ask = orders.asks[0].price;
lowest_ask_base_size = orders.asks[0].base;
lowest_ask_quote_size = orders.asks[0].quote;
}

if(!orders.bids.empty())
highest_bid = orders.bids[0].price;
{
highest_bid = orders.bids[0].price;
highest_bid_base_size = orders.bids[0].base;
highest_bid_quote_size = orders.bids[0].quote;
}

}

market_ticker::market_ticker(const fc::time_point_sec& now,
Expand All @@ -82,7 +95,11 @@ market_ticker::market_ticker(const fc::time_point_sec& now,
quote = asset_quote.symbol;
latest = "0";
lowest_ask = "0";
lowest_ask_base_size = "0";
lowest_ask_quote_size = "0";
highest_bid = "0";
highest_bid_base_size = "0";
highest_bid_quote_size = "0";
percent_change = "0";
base_volume = "0";
quote_volume = "0";
Expand Down
7 changes: 6 additions & 1 deletion libraries/app/include/graphene/app/api_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ namespace graphene { namespace app {
string quote;
string latest;
string lowest_ask;
string lowest_ask_base_size;
string lowest_ask_quote_size;
string highest_bid;
string highest_bid_base_size;
string highest_bid_quote_size;
string percent_change;
string base_volume;
string quote_volume;
Expand Down Expand Up @@ -178,7 +182,8 @@ FC_REFLECT( graphene::app::full_account,
FC_REFLECT( graphene::app::order, (price)(quote)(base) );
FC_REFLECT( graphene::app::order_book, (base)(quote)(bids)(asks) );
FC_REFLECT( graphene::app::market_ticker,
(time)(base)(quote)(latest)(lowest_ask)(highest_bid)(percent_change)(base_volume)(quote_volume) );
(time)(base)(quote)(latest)(lowest_ask)(lowest_ask_base_size)(lowest_ask_quote_size)
(highest_bid)(highest_bid_base_size)(highest_bid_quote_size)(percent_change)(base_volume)(quote_volume) );
FC_REFLECT( graphene::app::market_volume, (time)(base)(quote)(base_volume)(quote_volume) );
FC_REFLECT( graphene::app::market_trade, (sequence)(date)(price)(amount)(value)(side1_account_id)(side2_account_id) );

Expand Down