This repository has been archived by the owner on Jun 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Issue #561: [HitBTC] OrderBook is missing support of timestamp #563
Open
dp770
wants to merge
7
commits into
bitrich-info:develop
Choose a base branch
from
dp770:HitBTC_timestamp_attribute_suuport_in_orderbook
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d173251
Issue #561: [HitBTC] OrderBook is missing support of timestamp
63dc267
Issue #561: [HitBTC] OrderBook is missing support of timestamp. Using…
2a9e05d
Issue #561: [HitBTC] OrderBook is missing support of timestamp. Using…
58ec5c6
Merge branch 'develop' into HitBTC_timestamp_attribute_suuport_in_ord…
dp770 2346111
Issue #561: [HitBTC] OrderBook is missing support of timestamp. Using…
5ef9d74
Merge remote-tracking branch 'origin/HitBTC_timestamp_attribute_suupo…
abd7f40
Merge branch 'develop' into HitBTC_timestamp_attribute_suuport_in_ord…
dp770 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...btc/src/main/java/info/bitrich/xchangestream/hitbtc/dto/HitbtcOrderBookWithTimestamp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package info.bitrich.xchangestream.hitbtc.dto; | ||
|
||
import org.knowm.xchange.hitbtc.v2.dto.HitbtcOrderBook; | ||
import org.knowm.xchange.hitbtc.v2.dto.HitbtcOrderLimit; | ||
|
||
import java.util.Date; | ||
|
||
public class HitbtcOrderBookWithTimestamp extends HitbtcOrderBook { | ||
|
||
private final Date timestamp; | ||
|
||
HitbtcOrderBookWithTimestamp(Date timestamp, HitbtcOrderLimit[] asks, HitbtcOrderLimit[] bids) { | ||
super(asks, bids); | ||
this.timestamp = timestamp; | ||
} | ||
|
||
public Date getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder asks = new StringBuilder(); | ||
StringBuilder bids = new StringBuilder(); | ||
|
||
for (HitbtcOrderLimit ask : getAsks()) { | ||
asks.append(ask).append(';'); | ||
} | ||
|
||
for (HitbtcOrderLimit bid : getBids()) { | ||
bids.append(bid).append(';'); | ||
} | ||
|
||
return "HitbtcOrderBookWithTimestamp{" + | ||
"asks=" + asks + | ||
", bids=" + bids + | ||
", timestamp=" + timestamp + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
} | ||
], | ||
"symbol": "ETHBTC", | ||
"sequence": 8073827 | ||
"sequence": 8073827, | ||
"timestamp": "2020-05-03T18:26:28.714Z" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see how this is being used. I'd expect to see a corresponding change in https://github.com/bitrich-info/xchange-stream/blob/develop/xchange-stream-hitbtc/src/main/java/info/bitrich/xchangestream/hitbtc/HitbtcStreamingMarketDataService.java to feed the timestamp to clients?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally, I extended HitbtcAdapters.adaptOrderBook method from the org.knowm.xchange library to support timestamps. However, ideally, it should be updated at the source library, rather than "overridden" here. Having said that, I'm fine to commit it as well if it does make sense.