From 46f71952f90b595c90655fcb6708779fe2f629da Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 22 Mar 2021 09:26:17 +1100 Subject: [PATCH] Feature: GoCryptoTrader Backtester (#622) * Backtester: event handler completed, basic back tester support is working * Backtester: support for ticker data added, general code clean up, start of risk & size manageR * Backtester: WIP * Me: I am going to write tests and comment as I go this time, also me: doesn't write any tests or comments as i go * Backtester: work on orderbook system to track orders, increased test coverage * Backtester: further test coverage, output json, start of js chart output * Backtester: test coverage, output strat name * Backtester: WIP * WIP backtest charts * WIP on template * Backtester: further test coverage added * Backtester: WIP * backtester: attempting easier to read template for backtesting output * comments, and tests * Backtester: end of day WIP started work on risk management for handling leveraged positions * Backtester: WIP * Backtester: started heavy documentation phase for handover * Backtester: started heavy documentation phase for handover * Backtester: further comments, also work on making chart solution modular to allow for usage outside backtester (e.g OHCLV data) * Backtester: CHART LIBRARY * Backtester: move backtester over to new chart library * Backtester: removed old chart templates, template updates * Chart: add advancedintervaldata, convert from stats -> chart * Chart: gctscript hookup to generate chart from OHLCV data * Chart: reworked template to load from generated data if no template path is set * chart: template wip * correclty generate backtester readme, readme generation for charts, chart data generation * Removed old read file methods * Removed chart library from backtest as its now standalone * Remove reference to unfinish TA code. Removes value calculation from order signal. It belongs with portfolio signal * regen * Re-jiggles everything around to not have import cycle issues and makes it look like a normal application * End of day commit creates a new function to setup a backtester from a settings struct. Doesn't work though lol * Builds up more backtest work to allow to be run from the command line * Regen RPC * End of day mind mine field of RSI calculation5 * Finishes basic main.go application * Minor updates while theorising * Rearranging things like the size and data types. Adds portfolio setup like a normal human. Allows positions to be decimal based since this is for CRYPTOCURRENCIES :o * Moves code around to related positions. Adds compatibility to ordermanager to handle order submission. Fails to do things * End of day commit. Adding config based loading for indiviual strats. Attempting to allow for multiple cps per strategy as well as loading fees * End of day commit. Expanding config definition and loading implementation. Attempting to setup backtester wide multi currency support in a strategy. * Moves risk, attempts to revert multi currency, but also supports more in depth multi currency for later...... in the portfolio * End of day commit for realsies. Updates the strat and sets the invalid backtester * No more panics. Finishes config loading. Renames buyandhold to dollarcostaverage * Extends strategy to include a reason why its performing an action. Adds 420blazeit.strat. Expands statistics output. Moves folders around some more. Reduces amount of processing when "DO NOTHING" is the direction * Commit before home time. Looks to expand the order manager to cater to the backtester. Fleshes out risk manager to think about leverage and holdings in other currencies * Some basic expanding of strategy definitions. Changes weird package naming. * Expands size and risk validations. Expands config settings for the validation. Starts looking at loading from live data source * Merge branch 'master' into backscratcher * Work towards having backtester load data * Adds support and tests for all data source loading except for LIVE * Some basic additions looking to append to data streams instead of load all at once, for the purpose of live data analysis * End of day commit where I broke functions * Adds live backtesting * Adds FANCY MATHS to correctly size orders before slippage. Rearranges minmaxing in config and strats * Prints out initial settings. Creates a lame slippage calculator. Ensures that order price/amounts respect OHLCV data. Adds customisable config variables that can influence a strategy * Fixes minor issues with rendering. Fixes portfolio buying and selling now * ALL OVER THE PLACE END OF DAY COMMIT! In order to expand stats, thing must be tracked appropriately, which they arent. Here we add the addition of a compliance.go to track orders specifically. This will allow for the holdings manager to keep track of base stats such as how much we hold versus whats in use along with profits Compliance holds snapshots of every tick and what orders were there across exchanges. Also added a random slippage calculator which will allow a user to set their own slippage rates * Another fun end of day commit where nothing works. In order to have accurate stats, you need accurate positions, to have accurate positions you need to break things down to individual levels and store them. This is part of that process of ensuring that we can have multiple settings and everything processed appropriately. * Finalises multi currency config and support at most levels with exception to data loading. Simplifies some struct property definitions by removing redundancy Allows tracking of entire portfolio snapshots after each interval to track the entire process Lowercases use of exchange names * Sets the different prices to track across time. Attempts to sort out compliance snapshots * end of day commit. Moving compliance to the portfolio to manager and track all transactions at each interval. * Moves compliance calculation to portfolio.go. Adds a nice little decorator on the compliance manager orders to keep track of slippage, cost basis, volume adjusted price and close price. Moves "positions" to "hodlings" to be more accurate. Ensures exchange value calculations are accurate. Begins looking at Statistics and hodlings * Moves statistics to eventhandlers. Removes ticker work as not needed. Redefines hodler properties * hodlings are actually part of the portfolio * Renamed 420blazeit.strat file. Renamed hodlings to holdings. Moved Datahandler to data_types.go. Expanded holdings calculations, doesn't work, but we're getting somewhere. Renamed bad var names in backtest.go. Added new order side types to highlight lack of action reasons * Adds tests for holdings to ensure that holding snapshot calculation is accurate for the length of a strategy. Removes portfolio.Funds because its now handled via the holdings snapshots. Adds helper functions to Holding snapshots to retrieve relevant holdings. Updates sizing calculation to properly handle sell events. Expands holdings definitions to allow for comparison. Expands risk calculations to include holding snapshots so as to analyse all positions simultaneously * Changing the statistics results to consider all datas, with the ultimate goal to replace the current statistics package with this multi currency output * Made "Why" more generic. Expands statistics output. Removes time tying to stats map. Moves order event to correct location. Removes some debug lines. * Adds some raw funky drawdown statistics :tada: * End of day commit. experimentation leaves little code changes * An attempt at expanding statistics. Need to have ones dedicated to exchange, asset, pair. Early work for having global map to track all the asset things to minimise all the maps throughout the application * :tada: ADDS MULTI CURRENCY SUPPORT TO FOR THE BACKTESTER :tada: Can either execute strategies by assessing multiple currencies individually, or as a group and make strategic decisions on what currency to signal in. Adds new strat files to demonstrate * End of day shenanigans. Moving codes around, making more fun stats. Expanding DCA strat to check if DCA is better than the market longer term * Adds sharpe ratio and total stats for final output if more than one currency is considered * Adds sortino ratio and test for validation * Adds information ratio * Adds calmar ratio * Adds CAGR * Slims down the statistics file to only include my work. Updates everything to use interfaces rather than direct code references to make it easier to swap out codes. Begins looking at serialising statistics for reports * More neatening. Removal of old FAKE tests. Can now output a report in JSON * End of day commit. Creation of reporting. Uses tradingview charting library and some basic bootstrap CDN to render content nicely. Will be updating everything to have a special kline item to annotate chart results * Minor formatting changes before all the reviews * End of day commit. Expands reporting to have an enhanced candle. These candles contain metadata on whether an order has been placed and to mark charts appropriately. This will be expanded to have all the stats and make it pretty * Extra code I forgot to commit! * Fixes an issue where data cannot render above 1,100 candles by stopping it from rendering more than that.. * End of day commit. There is no inclusivity with candle requests and I cant figure it out right now. * Fixes issue with missing data by adding events when data isnt present and classifying it. Adds new way for klines to verify data with a bit more clarity * Completes report generation * Improves cagr. removes butts. Replaces old kline function with new supercalc * Adds readme templates and files across whole backtester. Renames 420rsi to more appropriate name. Moves interfaces to common * Some extra documentation * New header * Adds some nice coverage to backtest.go. Updats readmes to use new backtester header template * End of day crappy test commit * Adds report coverage... Somewhat. Adds template path and output path to allow custom properties and easier testing. Fixes interface duplication * Adds some lame tests. * Fixes test * Adds coverage to the exchange event handler * Minor test changes * Fixes slippage calculations based on buying and selling. Adds more tests to compliance and holdings * Rejiggles risk assessment to properly consider leverage if it were ever to be implemented fully. Removes bot dependency and adds coverage to the risk package * Expands coverage to sizing * Rejiggles code to add coverage for the portfolio package and its compatriots. * Adds additional testing to the backtester along with some data gathering tests * Tried and failed attempt to expand testing for the database. * Adds testing for kline, data, statistics * into the 70%s of coverage! Adds tests for base, DCA, statistics * Adds test coverage of strategies * Adds test coerage to statistics. updates template generation to not require CurrencyStatistics to have EAP. Removes EAP from currencystatistics * Adds coverage to currencystatistics.go BUT ITS NOT COMPLETE * 86% coverage wow. Fixes 2 tests * Fixes data races due to engine dependency craziness. Changes order manager to not have a global dependency * Completes currencystatistics test coverage * Some linting fixes * Adds new documentation to the bakctester config. Updates how risk leverage/ratios work with a single map. * Minor documentation changes. Its difficult to describe how it all works * Redefines strats and strat tests. Adds some really light documentation * Updates some basic documentation. * Fixes lazy bugs * Fixes bug in fill event processing. Fixes bug in statistics crashing. Fixes report generation. Fixes multi-currency processing to still process non-errored signals * More documentation. * Fixes ALL LINTING ISSUES * Cuts off unnecessary limbs/interface functions. linting. Adding comments to all functions. Adding ability to use whalebomb to calculate slippage for live orders. Adds testing for it too. Simplifies adding events to statistics. * Removes a weird overlap of holding features that made no sense and the writer of those functions should be ASHAMED. Adds additional documentation * Fixes issue with data being outside ranges. Adds some extra validation to areas where people can mess around. Makes generating configs easier with consistent dates. Adds more documentation. Cleans up okex/okcoin implementation to some functions since people aren't understanding that they share a based okgroup and that anything that is the same between two functions only needs to be written once...................... Also fixes some bad gct script code * Updated image and slight change to readme * Removes unused code. Fixes up verbose and removes old comment * Fixes issues with data validation for other data sources. Fixes bad reference in template * Fixes missing data problem for last candle considered missing. Fixes issue where fill order crashes when sizing error occurs. Adds documentation * Fixes issue with drawdown calculations. Fixes live data usage * Adds some comments for good measure * Default strat fix * Fixes surprise linting issues * gofmt * New linting issue with every commit * Fixes testing. Adds new config setting to set a custom gocryptotrader config path. Updates config tests to use dryrun. Results now include the nickname in the file for easier identification * Fixes live testing bitstamp. Fixes some template issues. Adds comments. * Updates max drawdown calculation to go peak vs trough. Fixes minor return issue. Removes unnecessary Data implementations. Removes weird verbose false. Fixes holdings calculations for boughtvalue. Removes Swingholder and just uses Swing. Fixes time calculation issue in kline * End of day commit that breaks things. Fixes issue with documentation generation only going one space deep. Adds exchange name to warnings of missing candle data. Renames missing candle data function. Adds some testing to kline functions. Adds new ability to size modified orders to portfolio allowance. Addresses defer close and other small nits. Fixes slow loop * End of day commit. There are too many mini changes to list. DateType to int. Default switch case. Returning earlier. Nil returns instead of ok. High low price in data, now used in max drop down. Missing data shown in the report. * End of day commit moving things from stats to maths. * Move the rest to math package and add testing * Ammends slippage calculations for live. Adds sizing funds to order event. Improves CAGR calculation * Mini fix commit for test * End of day mini change for documentation * Fixes in documentation and expanded error messages. Pretties up the report * minor adjustments to sharpe ratio and other ratio calculations * Fixes test by taking it out back. linting * Fixes tests * Fixes some tests, addresses some poor nits * More test and lint fixes * Fixes binance translation issue * Further craziness into reducing the concurrent test issues * lint * Mini fix * Geometric average added and tested. Adjusts application to support it. End of day experiementation with negative geometric mean. Fixes typo in currencystatistics package name * Fixes geometric calculation. Adds sweet CMD logo * fixes geometric mean :laughing: can now disable logo output if you hate everything good in life * lint * Should fix test in appveyor by not being nil * Fixes chance of getting no trades error. Maybe making nil events in the test will stop this poorly formed appveyor error * Forgotten Y tail * Check-ch-check-check-check-ch-check it out, minimising stutter is what its all about... Also provides more verbose error messages * de-ooopsies the whoopsie * Attempts to further address race issues when using global logs during start stop process * Includes a copy of the logger itself when logging so that no log.Debug action can create a data race upon being changed globally * Reduces bot usage further * Removes sharpie from b-acktester * comments, renames and bears, oh my! * Fixes git merge issues/tests. Splits average calculation into their own functions. Clarifies math function and sell position comments. Removes taker fee from final report. Adds warning when maker and taker aren't appropriately set. Fixes config testing issue where the config was saved when running exchange_template tests. Adds new test to ensure the testconfig isn't changed unnecessarily * More why to reason * Remove test due to hash discrepancy. * Updates maths to use errors. Updates tests to support it. * Fixes error handling for some packages. Uses position value instead of position size. Fixes leverage ratio work. Removes extra binance windows * Removes references to "multi currency" to shiny new verbiage "simultaneous processing" * Fixes issue with extra data be appended and then declared missing * Removes redundant code via code removal * Does a larger transition to using error types. Addresses math related nits * eat a mint while you lint * Completes err definition sweep * replaces over 80 instances of the same typo! * Renames more properties with Maximum ratios. Adds examples to config readme. Updates config maker takers. Adds cool kline error * Adds 'InclusiveEndDate' config property to API and Database datas. Adds testing for it. Updates readme for it * splint * Minor naming fix. Minor drawdown fix. Attempts to lower the bot usage when heaps of candles are requested. * Large data set processing improvements * Speeds up backtesting processing. Ensures rate limits are set Processing of most events is done in a linear fashion. So functions that relied on checking an events time for example, will now check the latest before processing every interval. The functions will still work normally in the event that someone wishes to use them out of order, but for general backtesting, it greatly speeds up all processing. Further, rather than comparing times all the time, I've introduced offsets for comparisons of ints for events and with candle data tests * Fixes build issue * Adds committed funds stat. Adds config goal Committed funds are calculated as the total amount of money currently in position It allows for a strategist to get the maximum returns for the smallest funds The goal function is to allow a strategist to set a goal description * Fixes data race * Adds unfinished config builder application * End of day broken commit I focussed on too many things at once and there are many things left to resolve * Fixees panics * Finishes config builder * Fixes order manager start/stop. Improves config manager * Fixes writefile reference * Adds some extra readme * Makes a more user friendly config builder. Fixes initial nil. Adds more order size reasons * lint * Adds warnings for when data is missing and ratios will be skewed * bodMISSED bodmas * Does not consider initial entry in performance calculations Adds strategy description field Adds cost basis to chart Fixes time rendering on default configs * Fixes bug in ratio calculations * saveConfig := !(!false != !true) == true * lint * Fixes start end single day drawdowns. Expands cmd drawdown explanation * Comment on rounding, updated report rounding * Addresses readme link issues * Actually fixes readme references * Should truly solve readme links.... * Includes filename for report log * Fixes panics, reduces csv trade candle size, no more science * Removes more science * test123 * Adds extra config validation * Fixes the date validation * Shows smaller fees * Changes perfectly cromulent error message to start >= end Co-authored-by: Andrew Jackson --- CONTRIBUTORS | 14 +- LICENSE | 2 +- README.md | 21 +- backtester/README.md | 106 + backtester/backtest/README.md | 56 + backtester/backtest/backtest.go | 980 + backtester/backtest/backtest_test.go | 554 + backtester/backtest/backtest_types.go | 40 + backtester/common/README.md | 44 + backtester/common/backtester.png | Bin 0 -> 86130 bytes backtester/common/common.go | 15 + backtester/common/common_types.go | 107 + backtester/config/README.md | 167 + backtester/config/config.go | 183 + backtester/config/config_test.go | 1005 + backtester/config/config_types.go | 136 + backtester/config/configbuilder/README.md | 53 + backtester/config/configbuilder/main.go | 652 + backtester/config/examples/README.md | 52 + .../dca-api-candles-multiple-currencies.strat | 95 + ...-api-candles-simultaneous-processing.strat | 95 + .../config/examples/dca-api-candles.strat | 68 + .../config/examples/dca-api-trades.strat | 68 + .../config/examples/dca-candles-live.strat | 70 + .../config/examples/dca-csv-candles.strat | 66 + .../config/examples/dca-csv-trades.strat | 66 + .../examples/dca-database-candles.strat | 81 + .../config/examples/rsi-api-candles.strat | 99 + backtester/data/README.md | 50 + backtester/data/data.go | 118 + backtester/data/data_test.go | 109 + backtester/data/data_types.go | 61 + backtester/data/kline/README.md | 49 + backtester/data/kline/api/README.md | 47 + backtester/data/kline/api/api.go | 52 + backtester/data/kline/api/api_test.go | 86 + backtester/data/kline/csv/README.md | 69 + backtester/data/kline/csv/csv.go | 160 + backtester/data/kline/csv/csv_test.go | 62 + backtester/data/kline/database/README.md | 53 + backtester/data/kline/database/database.go | 66 + .../data/kline/database/database_test.go | 208 + backtester/data/kline/kline.go | 146 + backtester/data/kline/kline_test.go | 288 + backtester/data/kline/kline_types.go | 21 + backtester/data/kline/live/README.md | 47 + backtester/data/kline/live/live.go | 65 + backtester/data/kline/live/live_test.go | 82 + backtester/eventhandlers/README.md | 47 + .../eventhandlers/eventholder/README.md | 46 + .../eventhandlers/eventholder/eventholder.go | 27 + .../eventholder/eventholder_test.go | 48 + .../eventholder/eventholder_types.go | 17 + backtester/eventhandlers/exchange/README.md | 58 + backtester/eventhandlers/exchange/exchange.go | 269 + .../eventhandlers/exchange/exchange_test.go | 294 + .../eventhandlers/exchange/exchange_types.go | 54 + .../eventhandlers/exchange/slippage/README.md | 54 + .../exchange/slippage/slippage.go | 38 + .../exchange/slippage/slippage_test.go | 35 + .../exchange/slippage/slippage_types.go | 8 + backtester/eventhandlers/portfolio/README.md | 68 + .../portfolio/compliance/README.md | 45 + .../portfolio/compliance/compliance.go | 51 + .../portfolio/compliance/compliance_test.go | 93 + .../portfolio/compliance/compliance_types.go | 36 + .../portfolio/holdings/README.md | 46 + .../portfolio/holdings/holdings.go | 92 + .../portfolio/holdings/holdings_test.go | 343 + .../portfolio/holdings/holdings_types.go | 45 + .../eventhandlers/portfolio/portfolio.go | 449 + .../eventhandlers/portfolio/portfolio_test.go | 469 + .../portfolio/portfolio_types.go | 65 + .../eventhandlers/portfolio/risk/README.md | 48 + .../eventhandlers/portfolio/risk/risk.go | 79 + .../eventhandlers/portfolio/risk/risk_test.go | 141 + .../portfolio/risk/risk_types.go | 36 + .../portfolio/settings/settings.go | 37 + .../portfolio/settings/settings_test.go | 39 + .../portfolio/settings/settings_types.go | 19 + .../eventhandlers/portfolio/size/README.md | 48 + .../eventhandlers/portfolio/size/size.go | 116 + .../eventhandlers/portfolio/size/size_test.go | 177 + .../portfolio/size/size_types.go | 19 + backtester/eventhandlers/statistics/README.md | 47 + .../statistics/currencystatistics/README.md | 73 + .../currencystatistics/currencystatistics.go | 332 + .../currencystatistics_test.go | 323 + .../currencystatistics_types.go | 84 + .../eventhandlers/statistics/statistics.go | 329 + .../statistics/statistics_test.go | 721 + .../statistics/statistics_types.go | 85 + backtester/eventhandlers/strategies/README.md | 61 + .../eventhandlers/strategies/base/README.md | 45 + .../eventhandlers/strategies/base/base.go | 48 + .../strategies/base/base_test.go | 71 + .../strategies/base/base_types.go | 11 + .../strategies/dollarcostaverage/README.md | 47 + .../dollarcostaverage/dollarcostaverage.go | 92 + .../dollarcostaverage_test.go | 208 + .../eventhandlers/strategies/rsi/README.md | 52 + .../eventhandlers/strategies/rsi/rsi.go | 166 + .../eventhandlers/strategies/rsi/rsi_test.go | 209 + .../eventhandlers/strategies/strategies.go | 43 + .../strategies/strategies_test.go | 56 + .../strategies/strategies_types.go | 20 + backtester/eventtypes/README.md | 47 + backtester/eventtypes/event/README.md | 45 + backtester/eventtypes/event/event.go | 63 + backtester/eventtypes/event/event_test.go | 79 + backtester/eventtypes/event/event_types.go | 22 + backtester/eventtypes/fill/README.md | 57 + backtester/eventtypes/fill/fill.go | 65 + backtester/eventtypes/fill/fill_test.go | 82 + backtester/eventtypes/fill/fill_types.go | 38 + backtester/eventtypes/kline/README.md | 44 + backtester/eventtypes/kline/kline.go | 21 + backtester/eventtypes/kline/kline_test.go | 41 + backtester/eventtypes/kline/kline_types.go | 16 + backtester/eventtypes/order/README.md | 57 + backtester/eventtypes/order/order.go | 72 + backtester/eventtypes/order/order_test.go | 78 + backtester/eventtypes/order/order_types.go | 35 + backtester/eventtypes/signal/README.md | 45 + backtester/eventtypes/signal/signal.go | 36 + backtester/eventtypes/signal/signal_test.go | 32 + backtester/eventtypes/signal/signal_types.go | 28 + backtester/main.go | 133 + backtester/report/README.md | 55 + backtester/report/report.go | 181 + backtester/report/report_test.go | 433 + backtester/report/report_types.go | 66 + backtester/report/tpl.gohtml | 733 + backtester/results/.gitignore | 4 + .../backtester_backtest_readme.tmpl | 22 + .../backtester_common_readme.tmpl | 10 + ...acktester_config_configbuilder_readme.tmpl | 19 + .../backtester_config_examples_readme.tmpl | 18 + .../backtester_config_readme.tmpl | 133 + .../backtester_data_kline_api_readme.tmpl | 13 + .../backtester_data_kline_csv_readme.tmpl | 35 + ...backtester_data_kline_database_readme.tmpl | 19 + .../backtester_data_kline_live_readme.tmpl | 13 + .../backtester_data_kline_readme.tmpl | 15 + .../backtester_data_readme.tmpl | 16 + ...ster_eventhandlers_eventholder_readme.tmpl | 12 + ...ktester_eventhandlers_exchange_readme.tmpl | 24 + ...venthandlers_exchange_slippage_readme.tmpl | 20 + ...thandlers_portfolio_compliance_readme.tmpl | 11 + ...enthandlers_portfolio_holdings_readme.tmpl | 12 + ...tester_eventhandlers_portfolio_readme.tmpl | 34 + ...r_eventhandlers_portfolio_risk_readme.tmpl | 14 + ...r_eventhandlers_portfolio_size_readme.tmpl | 14 + .../backtester_eventhandlers_readme.tmpl | 13 + ..._statistics_currencystatistics_readme.tmpl | 39 + ...ester_eventhandlers_statistics_readme.tmpl | 13 + ..._eventhandlers_strategies_base_readme.tmpl | 11 + ...s_strategies_dollarcostaverage_readme.tmpl | 13 + ...ester_eventhandlers_strategies_readme.tmpl | 27 + ...r_eventhandlers_strategies_rsi_readme.tmpl | 18 + .../backtester_eventtypes_event_readme.tmpl | 11 + .../backtester_eventtypes_fill_readme.tmpl | 23 + .../backtester_eventtypes_kline_readme.tmpl | 10 + .../backtester_eventtypes_order_readme.tmpl | 23 + .../backtester_eventtypes_readme.tmpl | 13 + .../backtester_eventtypes_signal_readme.tmpl | 11 + .../backtester_readme.tmpl | 72 + .../backtester_report_readme.tmpl | 21 + cmd/documentation/documentation.go | 13 +- .../root_templates/root_readme.tmpl | 1 + .../sub_templates/backtesting-header.tmpl | 15 + cmd/exchange_template/exchange_template.go | 38 +- .../exchange_template_test.go | 26 +- common/math/math.go | 206 +- common/math/math_test.go | 364 +- communications/smtpservice/smtpservice.go | 6 +- currency/forexprovider/base/README.md | 6 +- .../currencyconverterapi/README.md | 6 +- .../forexprovider/currencylayer/README.md | 6 +- .../exchangeratesapi.io/README.md | 6 +- currency/forexprovider/fixer.io/README.md | 6 +- .../forexprovider/openexchangerates/README.md | 6 +- .../repository/exchange/exchange_types.go | 3 +- engine/engine.go | 69 +- engine/engine_types.go | 10 +- engine/events.go | 24 +- engine/events_test.go | 47 +- engine/exchange.go | 28 +- engine/exchange_test.go | 73 +- engine/fake_exchange_test.go | 8 +- engine/helpers.go | 8 +- engine/helpers_test.go | 74 +- engine/orders.go | 129 +- engine/orders_test.go | 152 +- engine/orders_types.go | 1 + engine/restful_server.go | 2 +- engine/restful_server_test.go | 19 +- engine/routines.go | 58 +- engine/routines_test.go | 5 +- engine/rpcserver.go | 48 +- engine/rpcserver_test.go | 21 +- engine/syncer.go | 20 +- engine/withdraw.go | 6 +- engine/withdraw_test.go | 10 +- exchanges/binance/binance_test.go | 17 +- exchanges/binance/binance_wrapper.go | 38 +- exchanges/bitfinex/bitfinex_wrapper.go | 18 +- exchanges/bithumb/bithumb.go | 2 +- exchanges/bitstamp/bitstamp_wrapper.go | 18 +- exchanges/btcmarkets/btcmarkets_wrapper.go | 17 +- exchanges/btse/btse_wrapper.go | 2 +- exchanges/coinbasepro/coinbasepro_wrapper.go | 20 +- exchanges/ftx/ftx_wrapper.go | 16 +- exchanges/hitbtc/hitbtc_wrapper.go | 16 +- exchanges/kline/kline.go | 278 +- exchanges/kline/kline_test.go | 148 +- exchanges/kline/kline_types.go | 64 +- exchanges/lbank/lbank_wrapper.go | 17 +- exchanges/okcoin/okcoin_test.go | 2 +- exchanges/okcoin/okcoin_wrapper.go | 154 - exchanges/okex/okex_test.go | 2 +- exchanges/okex/okex_wrapper.go | 155 +- exchanges/okgroup/okgroup_wrapper.go | 157 + .../orderbook/simulator/simulator_test.go | 1 - exchanges/trade/trade.go | 8 +- exchanges/trade/trade_types.go | 2 + gctrpc/rpc.proto | 2724 +- gctscript/vm/manager.go | 6 +- gctscript/wrappers/gct/exchange/exchange.go | 4 +- gctscript/wrappers/gct/gctwrapper_test.go | 5 + log/logger.go | 6 +- log/logger_setup.go | 1 + log/loggers.go | 148 +- log/sublogger_types.go | 15 + main.go | 1 + .../binance_BTCUSDT_24h-trades_2020_11_16.csv | 1000 + testdata/http_mock/binance/binance.json | 28140 ++++++++++++++++ testdata/http_mock/bitstamp/bitstamp.json | 8008 +++++ 238 files changed, 57157 insertions(+), 2366 deletions(-) create mode 100644 backtester/README.md create mode 100644 backtester/backtest/README.md create mode 100644 backtester/backtest/backtest.go create mode 100644 backtester/backtest/backtest_test.go create mode 100644 backtester/backtest/backtest_types.go create mode 100644 backtester/common/README.md create mode 100644 backtester/common/backtester.png create mode 100644 backtester/common/common.go create mode 100644 backtester/common/common_types.go create mode 100644 backtester/config/README.md create mode 100644 backtester/config/config.go create mode 100644 backtester/config/config_test.go create mode 100644 backtester/config/config_types.go create mode 100644 backtester/config/configbuilder/README.md create mode 100644 backtester/config/configbuilder/main.go create mode 100644 backtester/config/examples/README.md create mode 100644 backtester/config/examples/dca-api-candles-multiple-currencies.strat create mode 100644 backtester/config/examples/dca-api-candles-simultaneous-processing.strat create mode 100644 backtester/config/examples/dca-api-candles.strat create mode 100644 backtester/config/examples/dca-api-trades.strat create mode 100644 backtester/config/examples/dca-candles-live.strat create mode 100644 backtester/config/examples/dca-csv-candles.strat create mode 100644 backtester/config/examples/dca-csv-trades.strat create mode 100644 backtester/config/examples/dca-database-candles.strat create mode 100644 backtester/config/examples/rsi-api-candles.strat create mode 100644 backtester/data/README.md create mode 100644 backtester/data/data.go create mode 100644 backtester/data/data_test.go create mode 100644 backtester/data/data_types.go create mode 100644 backtester/data/kline/README.md create mode 100644 backtester/data/kline/api/README.md create mode 100644 backtester/data/kline/api/api.go create mode 100644 backtester/data/kline/api/api_test.go create mode 100644 backtester/data/kline/csv/README.md create mode 100644 backtester/data/kline/csv/csv.go create mode 100644 backtester/data/kline/csv/csv_test.go create mode 100644 backtester/data/kline/database/README.md create mode 100644 backtester/data/kline/database/database.go create mode 100644 backtester/data/kline/database/database_test.go create mode 100644 backtester/data/kline/kline.go create mode 100644 backtester/data/kline/kline_test.go create mode 100644 backtester/data/kline/kline_types.go create mode 100644 backtester/data/kline/live/README.md create mode 100644 backtester/data/kline/live/live.go create mode 100644 backtester/data/kline/live/live_test.go create mode 100644 backtester/eventhandlers/README.md create mode 100644 backtester/eventhandlers/eventholder/README.md create mode 100644 backtester/eventhandlers/eventholder/eventholder.go create mode 100644 backtester/eventhandlers/eventholder/eventholder_test.go create mode 100644 backtester/eventhandlers/eventholder/eventholder_types.go create mode 100644 backtester/eventhandlers/exchange/README.md create mode 100644 backtester/eventhandlers/exchange/exchange.go create mode 100644 backtester/eventhandlers/exchange/exchange_test.go create mode 100644 backtester/eventhandlers/exchange/exchange_types.go create mode 100644 backtester/eventhandlers/exchange/slippage/README.md create mode 100644 backtester/eventhandlers/exchange/slippage/slippage.go create mode 100644 backtester/eventhandlers/exchange/slippage/slippage_test.go create mode 100644 backtester/eventhandlers/exchange/slippage/slippage_types.go create mode 100644 backtester/eventhandlers/portfolio/README.md create mode 100644 backtester/eventhandlers/portfolio/compliance/README.md create mode 100644 backtester/eventhandlers/portfolio/compliance/compliance.go create mode 100644 backtester/eventhandlers/portfolio/compliance/compliance_test.go create mode 100644 backtester/eventhandlers/portfolio/compliance/compliance_types.go create mode 100644 backtester/eventhandlers/portfolio/holdings/README.md create mode 100644 backtester/eventhandlers/portfolio/holdings/holdings.go create mode 100644 backtester/eventhandlers/portfolio/holdings/holdings_test.go create mode 100644 backtester/eventhandlers/portfolio/holdings/holdings_types.go create mode 100644 backtester/eventhandlers/portfolio/portfolio.go create mode 100644 backtester/eventhandlers/portfolio/portfolio_test.go create mode 100644 backtester/eventhandlers/portfolio/portfolio_types.go create mode 100644 backtester/eventhandlers/portfolio/risk/README.md create mode 100644 backtester/eventhandlers/portfolio/risk/risk.go create mode 100644 backtester/eventhandlers/portfolio/risk/risk_test.go create mode 100644 backtester/eventhandlers/portfolio/risk/risk_types.go create mode 100644 backtester/eventhandlers/portfolio/settings/settings.go create mode 100644 backtester/eventhandlers/portfolio/settings/settings_test.go create mode 100644 backtester/eventhandlers/portfolio/settings/settings_types.go create mode 100644 backtester/eventhandlers/portfolio/size/README.md create mode 100644 backtester/eventhandlers/portfolio/size/size.go create mode 100644 backtester/eventhandlers/portfolio/size/size_test.go create mode 100644 backtester/eventhandlers/portfolio/size/size_types.go create mode 100644 backtester/eventhandlers/statistics/README.md create mode 100644 backtester/eventhandlers/statistics/currencystatistics/README.md create mode 100644 backtester/eventhandlers/statistics/currencystatistics/currencystatistics.go create mode 100644 backtester/eventhandlers/statistics/currencystatistics/currencystatistics_test.go create mode 100644 backtester/eventhandlers/statistics/currencystatistics/currencystatistics_types.go create mode 100644 backtester/eventhandlers/statistics/statistics.go create mode 100644 backtester/eventhandlers/statistics/statistics_test.go create mode 100644 backtester/eventhandlers/statistics/statistics_types.go create mode 100644 backtester/eventhandlers/strategies/README.md create mode 100644 backtester/eventhandlers/strategies/base/README.md create mode 100644 backtester/eventhandlers/strategies/base/base.go create mode 100644 backtester/eventhandlers/strategies/base/base_test.go create mode 100644 backtester/eventhandlers/strategies/base/base_types.go create mode 100644 backtester/eventhandlers/strategies/dollarcostaverage/README.md create mode 100644 backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage.go create mode 100644 backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage_test.go create mode 100644 backtester/eventhandlers/strategies/rsi/README.md create mode 100644 backtester/eventhandlers/strategies/rsi/rsi.go create mode 100644 backtester/eventhandlers/strategies/rsi/rsi_test.go create mode 100644 backtester/eventhandlers/strategies/strategies.go create mode 100644 backtester/eventhandlers/strategies/strategies_test.go create mode 100644 backtester/eventhandlers/strategies/strategies_types.go create mode 100644 backtester/eventtypes/README.md create mode 100644 backtester/eventtypes/event/README.md create mode 100644 backtester/eventtypes/event/event.go create mode 100644 backtester/eventtypes/event/event_test.go create mode 100644 backtester/eventtypes/event/event_types.go create mode 100644 backtester/eventtypes/fill/README.md create mode 100644 backtester/eventtypes/fill/fill.go create mode 100644 backtester/eventtypes/fill/fill_test.go create mode 100644 backtester/eventtypes/fill/fill_types.go create mode 100644 backtester/eventtypes/kline/README.md create mode 100644 backtester/eventtypes/kline/kline.go create mode 100644 backtester/eventtypes/kline/kline_test.go create mode 100644 backtester/eventtypes/kline/kline_types.go create mode 100644 backtester/eventtypes/order/README.md create mode 100644 backtester/eventtypes/order/order.go create mode 100644 backtester/eventtypes/order/order_test.go create mode 100644 backtester/eventtypes/order/order_types.go create mode 100644 backtester/eventtypes/signal/README.md create mode 100644 backtester/eventtypes/signal/signal.go create mode 100644 backtester/eventtypes/signal/signal_test.go create mode 100644 backtester/eventtypes/signal/signal_types.go create mode 100644 backtester/main.go create mode 100644 backtester/report/README.md create mode 100644 backtester/report/report.go create mode 100644 backtester/report/report_test.go create mode 100644 backtester/report/report_types.go create mode 100644 backtester/report/tpl.gohtml create mode 100644 backtester/results/.gitignore create mode 100644 cmd/documentation/backtester_templates/backtester_backtest_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_common_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_config_configbuilder_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_config_examples_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_config_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_data_kline_api_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_data_kline_csv_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_data_kline_database_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_data_kline_live_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_data_kline_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_data_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_eventholder_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_slippage_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_compliance_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_holdings_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_risk_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_size_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_currencystatistics_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_base_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_dollarcostaverage_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_rsi_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventtypes_event_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventtypes_fill_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventtypes_kline_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventtypes_order_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventtypes_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_eventtypes_signal_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_readme.tmpl create mode 100644 cmd/documentation/backtester_templates/backtester_report_readme.tmpl create mode 100644 cmd/documentation/sub_templates/backtesting-header.tmpl create mode 100644 testdata/binance_BTCUSDT_24h-trades_2020_11_16.csv diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b09023b6..72c84b30 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -5,13 +5,13 @@ shazbert | https://github.com/shazbert gloriousCode | https://github.com/gloriousCode dependabot-preview[bot] | https://github.com/apps/dependabot-preview xtda | https://github.com/xtda -ermalguni | https://github.com/ermalguni -vadimzhukck | https://github.com/vadimzhukck -MadCozBadd | https://github.com/MadCozBadd Rots | https://github.com/Rots +vazha | https://github.com/vazha +ermalguni | https://github.com/ermalguni +MadCozBadd | https://github.com/MadCozBadd +vadimzhukck | https://github.com/vadimzhukck 140am | https://github.com/140am marcofranssen | https://github.com/marcofranssen -vazha | https://github.com/vazha dackroyd | https://github.com/dackroyd cranktakular | https://github.com/cranktakular woshidama323 | https://github.com/woshidama323 @@ -22,14 +22,14 @@ bretep | https://github.com/bretep Christian-Achilli | https://github.com/Christian-Achilli gam-phon | https://github.com/gam-phon cornelk | https://github.com/cornelk +dependabot[bot] | https://github.com/apps/dependabot if1live | https://github.com/if1live lozdog245 | https://github.com/lozdog245 soxipy | https://github.com/soxipy +mshogin | https://github.com/mshogin herenow | https://github.com/herenow blombard | https://github.com/blombard CodeLingoBot | https://github.com/CodeLingoBot -CodeLingoTeam | https://github.com/CodeLingoTeam -Daanikus | https://github.com/Daanikus daniel-cohen | https://github.com/daniel-cohen DirectX | https://github.com/DirectX frankzougc | https://github.com/frankzougc @@ -43,3 +43,5 @@ starit | https://github.com/starit Jimexist | https://github.com/Jimexist lookfirst | https://github.com/lookfirst merkeld | https://github.com/merkeld +CodeLingoTeam | https://github.com/CodeLingoTeam +Daanikus | https://github.com/Daanikus diff --git a/LICENSE b/LICENSE index beb5b952..a2bfbfcf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2020 The GoCryptoTrader Developers +Copyright (c) 2014-2021 The GoCryptoTrader Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 7294cc46..870ec0c1 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ However, we welcome pull requests for any exchange which does not match this cri + OHLCV/Candle retrieval support. See [OHLCV](/docs/OHLCV.md). + Scripting support. See [gctscript](/gctscript/README.md). + Recent and historic trade processing. See [trades](/exchanges/trade/README.md). ++ Backtesting application. An event-driven backtesting tool to test and iterate trading strategies using historical or custom data. See [backtester](/backtester/README.md). + WebGUI (discontinued). ## Planned Features @@ -142,18 +143,18 @@ Binaries will be published once the codebase reaches a stable condition. |User|Contribution Amount| |--|--| -| [thrasher-](https://github.com/thrasher-) | 645 | -| [shazbert](https://github.com/shazbert) | 199 | -| [gloriousCode](https://github.com/gloriousCode) | 173 | -| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 70 | +| [thrasher-](https://github.com/thrasher-) | 650 | +| [shazbert](https://github.com/shazbert) | 202 | +| [gloriousCode](https://github.com/gloriousCode) | 176 | +| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 87 | | [xtda](https://github.com/xtda) | 47 | +| [Rots](https://github.com/Rots) | 15 | +| [vazha](https://github.com/vazha) | 15 | | [ermalguni](https://github.com/ermalguni) | 14 | +| [MadCozBadd](https://github.com/MadCozBadd) | 10 | | [vadimzhukck](https://github.com/vadimzhukck) | 10 | -| [MadCozBadd](https://github.com/MadCozBadd) | 9 | -| [Rots](https://github.com/Rots) | 9 | | [140am](https://github.com/140am) | 8 | | [marcofranssen](https://github.com/marcofranssen) | 8 | -| [vazha](https://github.com/vazha) | 7 | | [dackroyd](https://github.com/dackroyd) | 5 | | [cranktakular](https://github.com/cranktakular) | 5 | | [woshidama323](https://github.com/woshidama323) | 3 | @@ -164,14 +165,14 @@ Binaries will be published once the codebase reaches a stable condition. | [Christian-Achilli](https://github.com/Christian-Achilli) | 2 | | [gam-phon](https://github.com/gam-phon) | 2 | | [cornelk](https://github.com/cornelk) | 2 | +| [dependabot[bot]](https://github.com/apps/dependabot) | 2 | | [if1live](https://github.com/if1live) | 2 | | [lozdog245](https://github.com/lozdog245) | 2 | | [soxipy](https://github.com/soxipy) | 2 | +| [mshogin](https://github.com/mshogin) | 2 | | [herenow](https://github.com/herenow) | 2 | | [blombard](https://github.com/blombard) | 1 | | [CodeLingoBot](https://github.com/CodeLingoBot) | 1 | -| [CodeLingoTeam](https://github.com/CodeLingoTeam) | 1 | -| [Daanikus](https://github.com/Daanikus) | 1 | | [daniel-cohen](https://github.com/daniel-cohen) | 1 | | [DirectX](https://github.com/DirectX) | 1 | | [frankzougc](https://github.com/frankzougc) | 1 | @@ -185,3 +186,5 @@ Binaries will be published once the codebase reaches a stable condition. | [Jimexist](https://github.com/Jimexist) | 1 | | [lookfirst](https://github.com/lookfirst) | 1 | | [merkeld](https://github.com/merkeld) | 1 | +| [CodeLingoTeam](https://github.com/CodeLingoTeam) | 1 | +| [Daanikus](https://github.com/Daanikus) | 1 | diff --git a/backtester/README.md b/backtester/README.md new file mode 100644 index 00000000..48807f6a --- /dev/null +++ b/backtester/README.md @@ -0,0 +1,106 @@ +# GoCryptoTrader Backtester: Backtester package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This backtester package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + + +# GoCryptoTrader Backtester +An event-driven backtesting tool to test and iterate trading strategies using historical or custom data. + +## Features +- Works with all GoCryptoTrader exchanges that support trade/candle retrieval. See [candle readme](/docs/OHLCV.md) and [trade readme](/exchanges/trade/README.md) for supported exchanges +- CSV data import +- Database data import +- Proof of concept live data running +- Can run strategies against multiple cryptocurrencies +- Can run strategies that can assess multiple currencies simultaneously to make complex decisions +- Dollar cost strategy implementation +- RSI strategy implementation +- Rules customisation via config `.strat` files +- Strategy customisation without requiring recompilation. For example, customising RSI high, low and length values via config `.strat` files. +- Report generation +- Portfolio manager to help size orders based on config rules, risk and candle volume +- Order manager to place orders with customisable slippage estimator +- Helpful statistics to help determine whether a strategy was effective +- Compliance manager to keep snapshots of every transaction and their changes at every interval + +## How does it work? +- The application will load a `.strat` config file as specified at runtime +- The `.strat` config file will contain + - Start & end dates + - The strategy to run + - The candle interval + - Where the data is to be sourced ([API](/backtester/data/kline/api/README.md), [CSV](/backtester/data/kline/csv/README.md), [database](/backtester/data/kline/database/README.md), [live](/backtester/data/kline/live/README.md)) + - Whether to use trade or candle data ([readme](/backtester/data/kline/README.md)) + - A nickname for the strategy (to help differentiate between runs/configs using the same strategy) + - The currency/currencies to use + - The exchange(s) to run against + - See [readme](/backtester/config/README.md) for a breakdown of all config features +- The GoCryptoTrader Backtester will retrieve the data specified in the config ([readme](/backtester/backtest/README.md)) +- The data is converted into candles and each candle is streamed as a data event. +- The data event is analysed by the strategy which will output a purchasing signal such as `BUY`, `SELL` or `DONOTHING` ([readme](/backtester/eventtypes/signal/README.md)) +- The purchase signal is then processed by the portfolio manager ([readme](/backtester/eventhandlers/portfolio/README.md)) which will size the order ([readme](/backtester/eventhandlers/portfolio/size/README.md)) and assess risk ([readme](/backtester/eventhandlers/portfolio/risk/README.md)) before sending it to the exchange +- The exchange order event handler will size to the candle data and run a slippage estimator ([readme](/backtester/eventhandlers/exchange/slippage/README.md)) and place the order ([readme](/backtester/eventhandlers/exchange/README.md)) +- Upon an order being placed, the order is snapshot for analysis in both the statistics package ([readme](/backtester/eventhandlers/statistics/README.md)) and the report package ([readme](/backtester/report/README.md)) + + +# Cool story, how do I use it? +To run the application using the provided dollar cost average strategy, simply run `go run .` from `gocryptotrader/backtester`. An output of the results will be put in the `results` folder. + +# How do I create my own config? +There is a config generating helper application under `/backtester/config/configbuilder` to help you create a `.strat` file. Read more about it [here](/backtester/config/configbuilder/README.md). There are also a number of tests under `/config/config_test.go` which generate configs into the `examples` folder, which if you have code knowledge, can write your own configs programmatically. + +# How do I create my own strategy? +Creating strategies requires programming skills. [Here](/backtester/eventhandlers/strategies/README.md) is a readme on the subject. After reading the readmes, please review the strategies [here](/backtester/eventhandlers/strategies/) to gain an understanding on how to write your own. + +# How does it work technically? +- The readmes linked in the "How does it work" covers the main parts of the application. + - If you are still unsure, please raise an issue, ask a question in our Slack or open a pull request +- Here is an overview +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +# Important notes +- This application is not considered production ready and you may experience issues + - If you encounter any issues, you can raise them in our Slack channel or via Github issues +- **Past performance is no guarantee of future results** +- While an experimental feature, it is **not** recommended to **ever** use live trading and real orders +- **Past performance is no guarantee of future results** + + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/backtest/README.md b/backtester/backtest/README.md new file mode 100644 index 00000000..ecd065be --- /dev/null +++ b/backtester/backtest/README.md @@ -0,0 +1,56 @@ +# GoCryptoTrader Backtester: Backtest package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/backtest) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This backtest package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Backtest package overview + +The backtest package is the most important package of the GoCryptoTrader backtester. It is the engine which combines all elements. +It is responsible for the following functionality +- Loading settings from a provided config file +- Retrieving data +- Loading the data into assessable chunks +- Analysing the data via the `handleEvent` function +- Looping through all data +- Outputting results into a report + + +A flow of the application is as follows: +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/backtest/backtest.go b/backtester/backtest/backtest.go new file mode 100644 index 00000000..66e26ea3 --- /dev/null +++ b/backtester/backtest/backtest.go @@ -0,0 +1,980 @@ +package backtest + +import ( + "errors" + "fmt" + "path/filepath" + "runtime" + "strings" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline/api" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline/csv" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline/database" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline/live" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/eventholder" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange/slippage" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/risk" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/settings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/size" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics/currencystatistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/backtester/report" + gctcommon "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/currency" + gctdatabase "github.com/thrasher-corp/gocryptotrader/database" + "github.com/thrasher-corp/gocryptotrader/engine" + gctexchange "github.com/thrasher-corp/gocryptotrader/exchanges" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// New returns a new BackTest instance +func New() *BackTest { + return &BackTest{ + shutdown: make(chan struct{}), + } +} + +// Reset BackTest values to default +func (bt *BackTest) Reset() { + bt.EventQueue.Reset() + bt.Datas.Reset() + bt.Portfolio.Reset() + bt.Statistic.Reset() + bt.Exchange.Reset() + bt.Bot = nil +} + +// NewFromConfig takes a strategy config and configures a backtester variable to run +func NewFromConfig(cfg *config.Config, templatePath, output string, bot *engine.Engine) (*BackTest, error) { + log.Infoln(log.BackTester, "loading config...") + if cfg == nil { + return nil, errNilConfig + } + if bot == nil { + return nil, errNilBot + } + bt := New() + + var e exchange.Exchange + bt.Datas = &data.HandlerPerCurrency{} + bt.EventQueue = &eventholder.Holder{} + reports := &report.Data{ + Config: cfg, + TemplatePath: templatePath, + OutputPath: output, + } + bt.Reports = reports + + err := bt.setupBot(cfg, bot) + if err != nil { + return nil, err + } + + e, err = bt.setupExchangeSettings(cfg) + if err != nil { + return nil, err + } + + bt.Exchange = &e + + buyRule := config.MinMax{ + MinimumSize: cfg.PortfolioSettings.BuySide.MinimumSize, + MaximumSize: cfg.PortfolioSettings.BuySide.MaximumSize, + MaximumTotal: cfg.PortfolioSettings.BuySide.MaximumTotal, + } + buyRule.Validate() + sellRule := config.MinMax{ + MinimumSize: cfg.PortfolioSettings.SellSide.MinimumSize, + MaximumSize: cfg.PortfolioSettings.SellSide.MaximumSize, + MaximumTotal: cfg.PortfolioSettings.SellSide.MaximumTotal, + } + sellRule.Validate() + sizeManager := &size.Size{ + BuySide: buyRule, + SellSide: sellRule, + } + + portfolioRisk := &risk.Risk{ + CurrencySettings: make(map[string]map[asset.Item]map[currency.Pair]*risk.CurrencySettings), + } + for i := range cfg.CurrencySettings { + if portfolioRisk.CurrencySettings[cfg.CurrencySettings[i].ExchangeName] == nil { + portfolioRisk.CurrencySettings[cfg.CurrencySettings[i].ExchangeName] = make(map[asset.Item]map[currency.Pair]*risk.CurrencySettings) + } + var a asset.Item + a, err = asset.New(cfg.CurrencySettings[i].Asset) + if err != nil { + return nil, fmt.Errorf( + "%w for %v %v %v. Err %v", + errInvalidConfigAsset, + cfg.CurrencySettings[i].ExchangeName, + cfg.CurrencySettings[i].Asset, + cfg.CurrencySettings[i].Base+cfg.CurrencySettings[i].Quote, + err) + } + if portfolioRisk.CurrencySettings[cfg.CurrencySettings[i].ExchangeName][a] == nil { + portfolioRisk.CurrencySettings[cfg.CurrencySettings[i].ExchangeName][a] = make(map[currency.Pair]*risk.CurrencySettings) + } + var curr currency.Pair + curr, err = currency.NewPairFromString(cfg.CurrencySettings[i].Base + cfg.CurrencySettings[i].Quote) + if err != nil { + return nil, fmt.Errorf( + "%w for %v %v %v. Err %v", + errInvalidConfigCurrency, + cfg.CurrencySettings[i].ExchangeName, + cfg.CurrencySettings[i].Asset, + cfg.CurrencySettings[i].Base+cfg.CurrencySettings[i].Quote, + err) + } + portfolioRisk.CurrencySettings[cfg.CurrencySettings[i].ExchangeName][a][curr] = &risk.CurrencySettings{ + MaximumOrdersWithLeverageRatio: cfg.CurrencySettings[i].Leverage.MaximumOrdersWithLeverageRatio, + MaxLeverageRate: cfg.CurrencySettings[i].Leverage.MaximumLeverageRate, + MaximumHoldingRatio: cfg.CurrencySettings[i].MaximumHoldingsRatio, + } + if cfg.CurrencySettings[i].MakerFee > cfg.CurrencySettings[i].TakerFee { + log.Warnf(log.BackTester, "maker fee '%v' should not exceed taker fee '%v'. Please review config", + cfg.CurrencySettings[i].MakerFee, + cfg.CurrencySettings[i].TakerFee) + } + } + var p *portfolio.Portfolio + p, err = portfolio.Setup(sizeManager, portfolioRisk, cfg.StatisticSettings.RiskFreeRate) + if err != nil { + return nil, err + } + for i := range e.CurrencySettings { + var lookup *settings.Settings + lookup, err = p.SetupCurrencySettingsMap(e.CurrencySettings[i].ExchangeName, e.CurrencySettings[i].AssetType, e.CurrencySettings[i].CurrencyPair) + if err != nil { + return nil, err + } + lookup.Fee = e.CurrencySettings[i].TakerFee + lookup.Leverage = e.CurrencySettings[i].Leverage + lookup.BuySideSizing = e.CurrencySettings[i].BuySide + lookup.SellSideSizing = e.CurrencySettings[i].SellSide + lookup.InitialFunds = e.CurrencySettings[i].InitialFunds + lookup.ComplianceManager = compliance.Manager{ + Snapshots: []compliance.Snapshot{}, + } + } + bt.Portfolio = p + + bt.Strategy, err = strategies.LoadStrategyByName(cfg.StrategySettings.Name, cfg.StrategySettings.SimultaneousSignalProcessing) + if err != nil { + return nil, err + } + bt.Strategy.SetDefaults() + if cfg.StrategySettings.CustomSettings != nil { + err = bt.Strategy.SetCustomSettings(cfg.StrategySettings.CustomSettings) + if err != nil && !errors.Is(err, base.ErrCustomSettingsUnsupported) { + return nil, err + } + } + stats := &statistics.Statistic{ + StrategyName: bt.Strategy.Name(), + StrategyNickname: cfg.Nickname, + StrategyDescription: bt.Strategy.Description(), + StrategyGoal: cfg.Goal, + ExchangeAssetPairStatistics: make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic), + RiskFreeRate: cfg.StatisticSettings.RiskFreeRate, + } + bt.Statistic = stats + reports.Statistics = stats + + cfg.PrintSetting() + + return bt, nil +} + +func (bt *BackTest) setupExchangeSettings(cfg *config.Config) (exchange.Exchange, error) { + log.Infoln(log.BackTester, "setting exchange settings...") + resp := exchange.Exchange{} + + for i := range cfg.CurrencySettings { + exch, pair, a, err := bt.loadExchangePairAssetBase( + cfg.CurrencySettings[i].ExchangeName, + cfg.CurrencySettings[i].Base, + cfg.CurrencySettings[i].Quote, + cfg.CurrencySettings[i].Asset) + if err != nil { + return resp, err + } + + exchangeName := strings.ToLower(exch.GetName()) + bt.Datas.Setup() + klineData, err := bt.loadData(cfg, exch, pair, a) + if err != nil { + return resp, err + } + bt.Datas.SetDataForCurrency(exchangeName, a, pair, klineData) + var makerFee, takerFee float64 + if cfg.CurrencySettings[i].MakerFee > 0 { + makerFee = cfg.CurrencySettings[i].MakerFee + } + if cfg.CurrencySettings[i].TakerFee > 0 { + takerFee = cfg.CurrencySettings[i].TakerFee + } + if makerFee == 0 || takerFee == 0 { + var apiMakerFee, apiTakerFee float64 + apiMakerFee, apiTakerFee = getFees(exch, pair) + if makerFee == 0 { + makerFee = apiMakerFee + } + if takerFee == 0 { + takerFee = apiTakerFee + } + } + + if cfg.CurrencySettings[i].MaximumSlippagePercent < 0 { + log.Warnf(log.BackTester, "invalid maximum slippage percent '%v'. Slippage percent is defined as a number, eg '100.00', defaulting to '%v'", + cfg.CurrencySettings[i].MaximumSlippagePercent, + slippage.DefaultMaximumSlippagePercent) + cfg.CurrencySettings[i].MaximumSlippagePercent = slippage.DefaultMaximumSlippagePercent + } + if cfg.CurrencySettings[i].MaximumSlippagePercent == 0 { + cfg.CurrencySettings[i].MaximumSlippagePercent = slippage.DefaultMaximumSlippagePercent + } + if cfg.CurrencySettings[i].MinimumSlippagePercent < 0 { + log.Warnf(log.BackTester, "invalid minimum slippage percent '%v'. Slippage percent is defined as a number, eg '80.00', defaulting to '%v'", + cfg.CurrencySettings[i].MinimumSlippagePercent, + slippage.DefaultMinimumSlippagePercent) + cfg.CurrencySettings[i].MinimumSlippagePercent = slippage.DefaultMinimumSlippagePercent + } + if cfg.CurrencySettings[i].MinimumSlippagePercent == 0 { + cfg.CurrencySettings[i].MinimumSlippagePercent = slippage.DefaultMinimumSlippagePercent + } + if cfg.CurrencySettings[i].MaximumSlippagePercent < cfg.CurrencySettings[i].MinimumSlippagePercent { + cfg.CurrencySettings[i].MaximumSlippagePercent = slippage.DefaultMaximumSlippagePercent + } + + realOrders := false + if cfg.DataSettings.LiveData != nil { + realOrders = cfg.DataSettings.LiveData.RealOrders + } + + buyRule := config.MinMax{ + MinimumSize: cfg.CurrencySettings[i].BuySide.MinimumSize, + MaximumSize: cfg.CurrencySettings[i].BuySide.MaximumSize, + MaximumTotal: cfg.CurrencySettings[i].BuySide.MaximumTotal, + } + buyRule.Validate() + sellRule := config.MinMax{ + MinimumSize: cfg.CurrencySettings[i].SellSide.MinimumSize, + MaximumSize: cfg.CurrencySettings[i].SellSide.MaximumSize, + MaximumTotal: cfg.CurrencySettings[i].SellSide.MaximumTotal, + } + sellRule.Validate() + resp.CurrencySettings = append(resp.CurrencySettings, exchange.Settings{ + ExchangeName: cfg.CurrencySettings[i].ExchangeName, + InitialFunds: cfg.CurrencySettings[i].InitialFunds, + MinimumSlippageRate: cfg.CurrencySettings[i].MinimumSlippagePercent, + MaximumSlippageRate: cfg.CurrencySettings[i].MaximumSlippagePercent, + CurrencyPair: pair, + AssetType: a, + ExchangeFee: takerFee, + MakerFee: takerFee, + TakerFee: makerFee, + UseRealOrders: realOrders, + BuySide: buyRule, + SellSide: sellRule, + Leverage: config.Leverage{ + CanUseLeverage: cfg.CurrencySettings[i].Leverage.CanUseLeverage, + MaximumLeverageRate: cfg.CurrencySettings[i].Leverage.MaximumLeverageRate, + MaximumOrdersWithLeverageRatio: cfg.CurrencySettings[i].Leverage.MaximumOrdersWithLeverageRatio, + }, + }) + } + + return resp, nil +} + +func (bt *BackTest) loadExchangePairAssetBase(exch, base, quote, ass string) (gctexchange.IBotExchange, currency.Pair, asset.Item, error) { + var err error + e := bt.Bot.GetExchangeByName(exch) + if e == nil { + return nil, currency.Pair{}, "", engine.ErrExchangeNotFound + } + + var cp, fPair currency.Pair + cp, err = currency.NewPairFromStrings(base, quote) + if err != nil { + return nil, currency.Pair{}, "", err + } + + var a asset.Item + a, err = asset.New(ass) + if err != nil { + return nil, currency.Pair{}, "", err + } + + exchangeBase := e.GetBase() + if !exchangeBase.ValidateAPICredentials() { + log.Warnf(log.BackTester, "no credentials set for %v, this is theoretical only", exchangeBase.Name) + } + + fPair, err = exchangeBase.FormatExchangeCurrency(cp, a) + if err != nil { + return nil, currency.Pair{}, "", err + } + return e, fPair, a, nil +} + +// setupBot sets up a basic bot to retrieve exchange data +// as well as process orders +func (bt *BackTest) setupBot(cfg *config.Config, bot *engine.Engine) error { + var err error + bt.Bot = bot + err = cfg.ValidateCurrencySettings() + if err != nil { + return err + } + + for i := range cfg.CurrencySettings { + err = bt.Bot.LoadExchange(cfg.CurrencySettings[i].ExchangeName, false, nil) + if err != nil && !errors.Is(err, engine.ErrExchangeAlreadyLoaded) { + return err + } + } + if !bt.Bot.OrderManager.Started() { + return bt.Bot.OrderManager.Start(bt.Bot) + } + + return nil +} + +// getFees will return an exchange's fee rate from GCT's wrapper function +func getFees(exch gctexchange.IBotExchange, fPair currency.Pair) (makerFee, takerFee float64) { + var err error + takerFee, err = exch.GetFeeByType(&gctexchange.FeeBuilder{ + FeeType: gctexchange.OfflineTradeFee, + Pair: fPair, + IsMaker: false, + PurchasePrice: 1, + Amount: 1, + }) + if err != nil { + log.Errorf(log.BackTester, "Could not retrieve taker fee for %v. %v", exch.GetName(), err) + } + + makerFee, err = exch.GetFeeByType(&gctexchange.FeeBuilder{ + FeeType: gctexchange.OfflineTradeFee, + Pair: fPair, + IsMaker: true, + PurchasePrice: 1, + Amount: 1, + }) + if err != nil { + log.Errorf(log.BackTester, "Could not retrieve maker fee for %v. %v", exch.GetName(), err) + } + + return makerFee, takerFee +} + +// loadData will create kline data from the sources defined in start config files. It can exist from databases, csv or API endpoints +// it can also be generated from trade data which will be converted into kline data +func (bt *BackTest) loadData(cfg *config.Config, exch gctexchange.IBotExchange, fPair currency.Pair, a asset.Item) (*kline.DataFromKline, error) { + log.Infof(log.BackTester, "loading data for %v %v %v...\n", exch.GetName(), a, fPair) + if exch == nil { + return nil, engine.ErrExchangeNotFound + } + b := exch.GetBase() + if cfg.DataSettings.DatabaseData == nil && + cfg.DataSettings.LiveData == nil && + cfg.DataSettings.APIData == nil && + cfg.DataSettings.CSVData == nil { + return nil, errNoDataSource + } + resp := &kline.DataFromKline{} + if (cfg.DataSettings.APIData != nil && cfg.DataSettings.DatabaseData != nil) || + (cfg.DataSettings.APIData != nil && cfg.DataSettings.LiveData != nil) || + (cfg.DataSettings.APIData != nil && cfg.DataSettings.CSVData != nil) || + (cfg.DataSettings.DatabaseData != nil && cfg.DataSettings.LiveData != nil) || + (cfg.DataSettings.CSVData != nil && cfg.DataSettings.LiveData != nil) || + (cfg.DataSettings.CSVData != nil && cfg.DataSettings.DatabaseData != nil) { + return nil, errAmbiguousDataSource + } + + dataType, err := common.DataTypeToInt(cfg.DataSettings.DataType) + if err != nil { + return nil, err + } + + switch { + case cfg.DataSettings.CSVData != nil: + if cfg.DataSettings.Interval <= 0 { + return nil, errIntervalUnset + } + resp, err = csv.LoadData( + dataType, + cfg.DataSettings.CSVData.FullPath, + strings.ToLower(exch.GetName()), + cfg.DataSettings.Interval, + fPair, + a) + if err != nil { + return nil, fmt.Errorf("%v. Please check your GoCryptoTrader configuration", err) + } + resp.Item.RemoveDuplicates() + resp.Item.SortCandlesByTimestamp(false) + resp.Range = gctkline.CalculateCandleDateRanges( + resp.Item.Candles[0].Time, + resp.Item.Candles[len(resp.Item.Candles)-1].Time.Add(cfg.DataSettings.Interval), + gctkline.Interval(cfg.DataSettings.Interval), + 0, + ) + err = resp.Range.VerifyResultsHaveData(resp.Item.Candles) + if err != nil { + if strings.Contains(err.Error(), "missing candles data between") { + log.Warn(log.BackTester, err.Error()) + } else { + return nil, err + } + } + case cfg.DataSettings.DatabaseData != nil: + if cfg.DataSettings.DatabaseData.InclusiveEndDate { + cfg.DataSettings.DatabaseData.EndDate = cfg.DataSettings.DatabaseData.EndDate.Add(cfg.DataSettings.Interval) + } + if cfg.DataSettings.DatabaseData.ConfigOverride != nil { + bt.Bot.Config.Database = *cfg.DataSettings.DatabaseData.ConfigOverride + gctdatabase.DB.DataPath = filepath.Join(gctcommon.GetDefaultDataDir(runtime.GOOS), "database") + gctdatabase.DB.Config = cfg.DataSettings.DatabaseData.ConfigOverride + err = bt.Bot.DatabaseManager.Start(bt.Bot) + if err != nil { + return nil, err + } + defer func() { + err = bt.Bot.DatabaseManager.Stop() + if err != nil { + log.Error(log.BackTester, err) + } + }() + } + resp, err = loadDatabaseData(cfg, exch.GetName(), fPair, a, dataType) + if err != nil { + return nil, fmt.Errorf("unable to retrieve data from GoCryptoTrader database. Error: %v. Please ensure the database is setup correctly and has data before use", err) + } + + resp.Item.RemoveDuplicates() + resp.Item.SortCandlesByTimestamp(false) + resp.Range = gctkline.CalculateCandleDateRanges( + cfg.DataSettings.DatabaseData.StartDate, + cfg.DataSettings.DatabaseData.EndDate, + gctkline.Interval(cfg.DataSettings.Interval), + 0, + ) + err = resp.Range.VerifyResultsHaveData(resp.Item.Candles) + if err != nil { + if strings.Contains(err.Error(), "missing candles data between") { + log.Warn(log.BackTester, err.Error()) + } else { + return nil, err + } + } + case cfg.DataSettings.APIData != nil: + if cfg.DataSettings.APIData.InclusiveEndDate { + cfg.DataSettings.APIData.EndDate = cfg.DataSettings.APIData.EndDate.Add(cfg.DataSettings.Interval) + } + resp, err = loadAPIData( + cfg, + exch, + fPair, + a, + b.Features.Enabled.Kline.ResultLimit, + dataType) + if err != nil { + return resp, err + } + case cfg.DataSettings.LiveData != nil: + if len(cfg.CurrencySettings) > 1 { + return nil, errors.New("live data simulation only supports one currency") + } + err = loadLiveData(cfg, b) + if err != nil { + return nil, err + } + go bt.loadLiveDataLoop( + resp, + cfg, + exch, + fPair, + a, + dataType) + return resp, nil + } + if resp == nil { + return nil, fmt.Errorf("processing error, response returned nil") + } + + err = b.ValidateKline(fPair, a, resp.Item.Interval) + if err != nil { + return nil, err + } + + err = resp.Load() + if err != nil { + return nil, err + } + bt.Reports.AddKlineItem(&resp.Item) + return resp, nil +} + +func loadDatabaseData(cfg *config.Config, name string, fPair currency.Pair, a asset.Item, dataType int64) (*kline.DataFromKline, error) { + if cfg == nil || cfg.DataSettings.DatabaseData == nil { + return nil, errors.New("nil config data received") + } + err := cfg.ValidateDate() + if err != nil { + return nil, err + } + if cfg.DataSettings.Interval <= 0 { + return nil, errIntervalUnset + } + + return database.LoadData( + cfg.DataSettings.DatabaseData.StartDate, + cfg.DataSettings.DatabaseData.EndDate, + cfg.DataSettings.Interval, + strings.ToLower(name), + dataType, + fPair, + a) +} + +func loadAPIData(cfg *config.Config, exch gctexchange.IBotExchange, fPair currency.Pair, a asset.Item, resultLimit uint32, dataType int64) (*kline.DataFromKline, error) { + err := cfg.ValidateDate() + if err != nil { + return nil, err + } + if cfg.DataSettings.Interval <= 0 { + return nil, errIntervalUnset + } + dates := gctkline.CalculateCandleDateRanges( + cfg.DataSettings.APIData.StartDate, + cfg.DataSettings.APIData.EndDate, + gctkline.Interval(cfg.DataSettings.Interval), + resultLimit) + candles, err := api.LoadData( + dataType, + cfg.DataSettings.APIData.StartDate, + cfg.DataSettings.APIData.EndDate, + cfg.DataSettings.Interval, + exch, + fPair, + a) + if err != nil { + return nil, fmt.Errorf("%v. Please check your GoCryptoTrader configuration", err) + } + err = dates.VerifyResultsHaveData(candles.Candles) + if err != nil && errors.Is(err, gctkline.ErrMissingCandleData) { + log.Warn(log.BackTester, err.Error()) + } else if err != nil { + return nil, err + } + + candles.FillMissingDataWithEmptyEntries(&dates) + candles.RemoveOutsideRange(cfg.DataSettings.APIData.StartDate, cfg.DataSettings.APIData.EndDate) + return &kline.DataFromKline{ + Item: *candles, + Range: dates, + }, nil +} + +func loadLiveData(cfg *config.Config, base *gctexchange.Base) error { + if cfg == nil || base == nil || cfg.DataSettings.LiveData == nil { + return common.ErrNilArguments + } + if cfg.DataSettings.Interval <= 0 { + return errIntervalUnset + } + + if cfg.DataSettings.LiveData.APIKeyOverride != "" { + base.API.Credentials.Key = cfg.DataSettings.LiveData.APIKeyOverride + } + if cfg.DataSettings.LiveData.APISecretOverride != "" { + base.API.Credentials.Secret = cfg.DataSettings.LiveData.APISecretOverride + } + if cfg.DataSettings.LiveData.APIClientIDOverride != "" { + base.API.Credentials.ClientID = cfg.DataSettings.LiveData.APIClientIDOverride + } + if cfg.DataSettings.LiveData.API2FAOverride != "" { + base.API.Credentials.PEMKey = cfg.DataSettings.LiveData.API2FAOverride + } + validated := base.ValidateAPICredentials() + base.API.AuthenticatedSupport = validated + if !validated && cfg.DataSettings.LiveData.RealOrders { + log.Warn(log.BackTester, "invalid API credentials set, real orders set to false") + cfg.DataSettings.LiveData.RealOrders = false + } + return nil +} + +// Run will iterate over loaded data events +// save them and then handle the event based on its type +func (bt *BackTest) Run() error { + log.Info(log.BackTester, "running backtester against pre-defined data") +dataLoadingIssue: + for ev := bt.EventQueue.NextEvent(); ; ev = bt.EventQueue.NextEvent() { + if ev == nil { + dataHandlerMap := bt.Datas.GetAllData() + for exchangeName, exchangeMap := range dataHandlerMap { + for assetItem, assetMap := range exchangeMap { + var hasProcessedData bool + for currencyPair, dataHandler := range assetMap { + d := dataHandler.Next() + if d == nil { + if !bt.hasHandledEvent { + log.Errorf(log.BackTester, "Unable to perform `Next` for %v %v %v", exchangeName, assetItem, currencyPair) + } + break dataLoadingIssue + } + if bt.Strategy.UseSimultaneousProcessing() && hasProcessedData { + continue + } + bt.EventQueue.AppendEvent(d) + hasProcessedData = true + } + } + } + } + + err := bt.handleEvent(ev) + if err != nil { + return err + } + if !bt.hasHandledEvent { + bt.hasHandledEvent = true + } + } + + return nil +} + +// handleEvent is the main processor of data for the backtester +// after data has been loaded and Run has appended a data event to the queue, +// handle event will process events and add further events to the queue if they +// are required +func (bt *BackTest) handleEvent(e common.EventHandler) error { + switch ev := e.(type) { + case common.DataEventHandler: + return bt.processDataEvent(ev) + case signal.Event: + bt.processSignalEvent(ev) + case order.Event: + bt.processOrderEvent(ev) + case fill.Event: + bt.processFillEvent(ev) + case nil: + default: + return fmt.Errorf("%w %v received, could not process", + errUnhandledDatatype, + e) + } + + return nil +} + +// processDataEvent determines what signal events are generated and appended +// to the event queue based on whether it is running a multi-currency consideration strategy order not +// +// for multi-currency-consideration it will pass all currency datas to the strategy for it to determine what +// currencies to act upon +// +// for non-multi-currency-consideration strategies, it will simply process every currency individually +// against the strategy and generate signals +func (bt *BackTest) processDataEvent(e common.DataEventHandler) error { + if bt.Strategy.UseSimultaneousProcessing() { + var dataEvents []data.Handler + dataHandlerMap := bt.Datas.GetAllData() + for _, exchangeMap := range dataHandlerMap { + for _, assetMap := range exchangeMap { + for _, dataHandler := range assetMap { + latestData := dataHandler.Latest() + bt.updateStatsForDataEvent(latestData) + dataEvents = append(dataEvents, dataHandler) + } + } + } + signals, err := bt.Strategy.OnSimultaneousSignals(dataEvents, bt.Portfolio) + if err != nil { + if errors.Is(err, base.ErrTooMuchBadData) { + // too much bad data is a severe error and backtesting must cease + return err + } + log.Error(log.BackTester, err) + return nil + } + for i := range signals { + err = bt.Statistic.SetEventForOffset(signals[i]) + if err != nil { + log.Error(log.BackTester, err) + } + bt.EventQueue.AppendEvent(signals[i]) + } + } else { + bt.updateStatsForDataEvent(e) + d := bt.Datas.GetDataForCurrency(e.GetExchange(), e.GetAssetType(), e.Pair()) + + s, err := bt.Strategy.OnSignal(d, bt.Portfolio) + if err != nil { + if errors.Is(err, base.ErrTooMuchBadData) { + // too much bad data is a severe error and backtesting must cease + return err + } + log.Error(log.BackTester, err) + return nil + } + err = bt.Statistic.SetEventForOffset(s) + if err != nil { + log.Error(log.BackTester, err) + } + bt.EventQueue.AppendEvent(s) + } + return nil +} + +// updateStatsForDataEvent makes various systems aware of price movements from +// data events +func (bt *BackTest) updateStatsForDataEvent(e common.DataEventHandler) { + // update portfolio with latest price + err := bt.Portfolio.Update(e) + if err != nil { + log.Error(log.BackTester, err) + } + // update statistics with latest price + err = bt.Statistic.SetupEventForTime(e) + if err != nil { + log.Error(log.BackTester, err) + } +} + +func (bt *BackTest) processSignalEvent(ev signal.Event) { + cs, err := bt.Exchange.GetCurrencySettings(ev.GetExchange(), ev.GetAssetType(), ev.Pair()) + if err != nil { + log.Error(log.BackTester, err) + return + } + var o *order.Order + o, err = bt.Portfolio.OnSignal(ev, &cs) + if err != nil { + log.Error(log.BackTester, err) + return + } + err = bt.Statistic.SetEventForOffset(o) + if err != nil { + log.Error(log.BackTester, err) + } + + bt.EventQueue.AppendEvent(o) +} + +func (bt *BackTest) processOrderEvent(ev order.Event) { + d := bt.Datas.GetDataForCurrency(ev.GetExchange(), ev.GetAssetType(), ev.Pair()) + f, err := bt.Exchange.ExecuteOrder(ev, d, bt.Bot) + if err != nil { + if f == nil { + log.Errorf(log.BackTester, "fill event should always be returned, please fix, %v", err) + return + } + log.Errorf(log.BackTester, "%v %v %v %v", f.GetExchange(), f.GetAssetType(), f.Pair(), err) + } + err = bt.Statistic.SetEventForOffset(f) + if err != nil { + log.Error(log.BackTester, err) + } + bt.EventQueue.AppendEvent(f) +} + +func (bt *BackTest) processFillEvent(ev fill.Event) { + t, err := bt.Portfolio.OnFill(ev) + if err != nil { + log.Error(log.BackTester, err) + return + } + + err = bt.Statistic.SetEventForOffset(t) + if err != nil { + log.Error(log.BackTester, err) + } + + var holding holdings.Holding + holding, err = bt.Portfolio.ViewHoldingAtTimePeriod(ev.GetExchange(), ev.GetAssetType(), ev.Pair(), ev.GetTime()) + if err != nil { + log.Error(log.BackTester, err) + } + + err = bt.Statistic.AddHoldingsForTime(&holding) + if err != nil { + log.Error(log.BackTester, err) + } + + var cp *compliance.Manager + cp, err = bt.Portfolio.GetComplianceManager(ev.GetExchange(), ev.GetAssetType(), ev.Pair()) + if err != nil { + log.Error(log.BackTester, err) + } + + snap := cp.GetLatestSnapshot() + err = bt.Statistic.AddComplianceSnapshotForTime(snap, ev) + if err != nil { + log.Error(log.BackTester, err) + } +} + +// RunLive is a proof of concept function that does not yet support multi currency usage +// It runs by constantly checking for new live datas and running through the list of events +// once new data is processed. It will run until application close event has been received +func (bt *BackTest) RunLive() error { + log.Info(log.BackTester, "running backtester against live data") + timeoutTimer := time.NewTimer(time.Minute * 5) + // a frequent timer so that when a new candle is released by an exchange + // that it can be processed quickly + processEventTicker := time.NewTicker(time.Second) + doneARun := false + for { + select { + case <-bt.shutdown: + return nil + case <-timeoutTimer.C: + return errLiveDataTimeout + case <-processEventTicker.C: + for e := bt.EventQueue.NextEvent(); ; e = bt.EventQueue.NextEvent() { + if e == nil { + // as live only supports singular currency, just get the proper reference manually + var d data.Handler + dd := bt.Datas.GetAllData() + for k1, v1 := range dd { + for k2, v2 := range v1 { + for k3 := range v2 { + d = dd[k1][k2][k3] + } + } + } + de := d.Next() + if de == nil { + break + } + bt.EventQueue.AppendEvent(de) + doneARun = true + continue + } + err := bt.handleEvent(e) + if err != nil { + return err + } + } + if doneARun { + timeoutTimer = time.NewTimer(time.Minute * 5) + } + } + } +} + +// loadLiveDataLoop is an incomplete function to continuously retrieve exchange data on a loop +// from live. Its purpose is to be able to perform strategy analysis against current data +func (bt *BackTest) loadLiveDataLoop(resp *kline.DataFromKline, cfg *config.Config, exch gctexchange.IBotExchange, fPair currency.Pair, a asset.Item, dataType int64) { + startDate := time.Now() + candles, err := live.LoadData( + exch, + dataType, + cfg.DataSettings.Interval, + fPair, + a) + if err != nil { + log.Errorf(log.BackTester, "%v. Please check your GoCryptoTrader configuration", err) + return + } + resp.Item = *candles + err = bt.loadLiveData(resp, cfg, exch, fPair, a, startDate, dataType) + if err != nil { + log.Error(log.BackTester, err) + return + } + + loadNewDataTicker := time.NewTicker(time.Second * 30) + for { + select { + case <-bt.shutdown: + return + case <-loadNewDataTicker.C: + err = bt.loadLiveData(resp, cfg, exch, fPair, a, startDate, dataType) + if err != nil { + log.Error(log.BackTester, err) + return + } + } + } +} + +func (bt *BackTest) loadLiveData(resp *kline.DataFromKline, cfg *config.Config, exch gctexchange.IBotExchange, fPair currency.Pair, a asset.Item, startDate time.Time, dataType int64) error { + candles, err := live.LoadData( + exch, + dataType, + cfg.DataSettings.Interval, + fPair, + a) + if err != nil { + return err + } + resp.Item.Candles = append(resp.Item.Candles, candles.Candles...) + _, err = exch.FetchOrderbook(fPair, a) + if err != nil { + return err + } + resp.Item.RemoveDuplicates() + resp.Item.SortCandlesByTimestamp(false) + if len(candles.Candles) == 0 { + return nil + } + endDate := candles.Candles[len(candles.Candles)-1].Time.Add(cfg.DataSettings.Interval) + if resp.Range.Ranges == nil { + dataRange := gctkline.CalculateCandleDateRanges( + startDate, + endDate, + gctkline.Interval(cfg.DataSettings.Interval), + 0, + ) + resp.Range = gctkline.IntervalRangeHolder{ + Start: gctkline.CreateIntervalTime(startDate), + End: gctkline.CreateIntervalTime(endDate), + Ranges: dataRange.Ranges, + } + } + var intervalData []gctkline.IntervalData + for i := range candles.Candles { + intervalData = append(intervalData, gctkline.IntervalData{ + Start: gctkline.CreateIntervalTime(candles.Candles[i].Time), + End: gctkline.CreateIntervalTime(candles.Candles[i].Time.Add(cfg.DataSettings.Interval)), + HasData: true, + }) + } + resp.Range.Ranges[0].Intervals = intervalData + if len(intervalData) > 0 { + resp.Range.Ranges[0].End = intervalData[len(intervalData)-1].End + } + + resp.Append(candles) + bt.Reports.AddKlineItem(&resp.Item) + log.Info(log.BackTester, "sleeping for 30 seconds before checking for new candle data") + return nil +} + +// Stop shuts down the live data loop +func (bt *BackTest) Stop() { + close(bt.shutdown) +} diff --git a/backtester/backtest/backtest_test.go b/backtester/backtest/backtest_test.go new file mode 100644 index 00000000..3aad0de4 --- /dev/null +++ b/backtester/backtest/backtest_test.go @@ -0,0 +1,554 @@ +package backtest + +import ( + "errors" + "log" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/eventholder" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/risk" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/size" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics/currencystatistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/dollarcostaverage" + "github.com/thrasher-corp/gocryptotrader/backtester/report" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/engine" + gctexchange "github.com/thrasher-corp/gocryptotrader/exchanges" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +const testExchange = "binance" + +func newBotWithExchange() (*engine.Engine, gctexchange.IBotExchange) { + bot, err := engine.NewFromSettings(&engine.Settings{ + ConfigFile: filepath.Join("..", "..", "testdata", "configtest.json"), + EnableDryRun: true, + }, nil) + if err != nil { + log.Fatal(err) + } + err = bot.LoadExchange(testExchange, false, nil) + if err != nil { + log.Fatal(err) + } + exch := bot.GetExchangeByName(testExchange) + if exch == nil { + log.Fatal("expected not nil") + } + return bot, exch +} + +func TestNewFromConfig(t *testing.T) { + t.Parallel() + _, err := NewFromConfig(nil, "", "", nil) + if err == nil { + t.Error("expected error for nil config") + } + + cfg := &config.Config{ + GoCryptoTraderConfigPath: filepath.Join("..", "..", "testdata", "configtest.json"), + } + _, err = NewFromConfig(cfg, "", "", nil) + if !errors.Is(err, errNilBot) { + t.Errorf("expected: %v, received %v", errNilBot, err) + } + + bot, _ := newBotWithExchange() + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, config.ErrNoCurrencySettings) { + t.Errorf("expected: %v, received %v", config.ErrNoCurrencySettings, err) + } + + cfg.CurrencySettings = []config.CurrencySettings{ + { + ExchangeName: "test", + Base: "test", + Quote: "test", + }, + } + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, config.ErrBadInitialFunds) { + t.Errorf("expected: %v, received %v", config.ErrBadInitialFunds, err) + } + + cfg.CurrencySettings[0].InitialFunds = 1337 + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, config.ErrUnsetAsset) { + t.Errorf("expected: %v, received %v", config.ErrUnsetAsset, err) + } + + cfg.CurrencySettings[0].Asset = asset.Spot.String() + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, engine.ErrExchangeNotFound) { + t.Errorf("expected: %v, received %v", engine.ErrExchangeNotFound, err) + } + + cfg.CurrencySettings[0].ExchangeName = testExchange + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, errNoDataSource) { + t.Errorf("expected: %v, received %v", errNoDataSource, err) + } + + cfg.CurrencySettings[0].Base = "BTC" + cfg.CurrencySettings[0].Quote = "USDT" + + cfg.DataSettings.APIData = &config.APIData{ + StartDate: time.Time{}, + EndDate: time.Time{}, + } + + _, err = NewFromConfig(cfg, "", "", bot) + if err != nil && !strings.Contains(err.Error(), "unrecognised dataType") { + t.Error(err) + } + cfg.DataSettings.DataType = common.CandleStr + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, config.ErrStartEndUnset) { + t.Errorf("expected: %v, received %v", config.ErrStartEndUnset, err) + } + + cfg.DataSettings.APIData.StartDate = time.Now().Add(-time.Hour) + cfg.DataSettings.APIData.EndDate = time.Now() + cfg.DataSettings.APIData.InclusiveEndDate = true + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, errIntervalUnset) { + t.Errorf("expected: %v, received %v", errIntervalUnset, err) + } + + cfg.DataSettings.Interval = gctkline.FifteenMin.Duration() + + _, err = NewFromConfig(cfg, "", "", bot) + if !errors.Is(err, base.ErrStrategyNotFound) { + t.Errorf("expected: %v, received %v", base.ErrStrategyNotFound, err) + } + + cfg.StrategySettings = config.StrategySettings{ + Name: dollarcostaverage.Name, + CustomSettings: map[string]interface{}{ + "hello": "moto", + }, + } + cfg.CurrencySettings[0].MakerFee = 1337 + cfg.CurrencySettings[0].TakerFee = 1337 + _, err = NewFromConfig(cfg, "", "", bot) + if err != nil { + t.Error(err) + } +} + +func TestLoadData(t *testing.T) { + t.Parallel() + cfg := &config.Config{ + GoCryptoTraderConfigPath: filepath.Join("..", "..", "testdata", "configtest.json"), + } + cfg.CurrencySettings = []config.CurrencySettings{ + { + ExchangeName: "test", + Asset: "test", + Base: "test", + Quote: "test", + }, + } + cfg.CurrencySettings[0].ExchangeName = testExchange + cfg.CurrencySettings[0].Asset = asset.Spot.String() + cfg.CurrencySettings[0].Base = "BTC" + cfg.CurrencySettings[0].Quote = "USDT" + cfg.CurrencySettings[0].InitialFunds = 1337 + cfg.DataSettings.APIData = &config.APIData{ + StartDate: time.Time{}, + EndDate: time.Time{}, + } + cfg.DataSettings.APIData.StartDate = time.Now().Add(-time.Hour) + cfg.DataSettings.APIData.EndDate = time.Now() + cfg.DataSettings.Interval = gctkline.FifteenMin.Duration() + cfg.DataSettings.DataType = common.CandleStr + cfg.StrategySettings = config.StrategySettings{ + Name: dollarcostaverage.Name, + CustomSettings: map[string]interface{}{ + "hello": "moto", + }, + } + cfg.CurrencySettings[0].MakerFee = 1337 + cfg.CurrencySettings[0].TakerFee = 1337 + bot, exch := newBotWithExchange() + + _, err := NewFromConfig(cfg, "", "", bot) + if err != nil { + t.Error(err) + } + bt := BackTest{ + Reports: &report.Data{}, + } + + cp := currency.NewPair(currency.BTC, currency.USDT) + _, err = bt.loadData(cfg, exch, cp, asset.Spot) + if err != nil { + t.Error(err) + } + + cfg.DataSettings.APIData = nil + cfg.DataSettings.DatabaseData = &config.DatabaseData{ + StartDate: time.Now().Add(-time.Hour), + EndDate: time.Now(), + ConfigOverride: nil, + InclusiveEndDate: true, + } + cfg.DataSettings.DataType = common.CandleStr + cfg.DataSettings.Interval = gctkline.FifteenMin.Duration() + + bt.Bot = bot + _, err = bt.loadData(cfg, exch, cp, asset.Spot) + if err != nil && !strings.Contains(err.Error(), "unable to retrieve data from GoCryptoTrader database") { + t.Error(err) + } + + cfg.DataSettings.DatabaseData = nil + cfg.DataSettings.CSVData = &config.CSVData{ + FullPath: "test", + } + _, err = bt.loadData(cfg, exch, cp, asset.Spot) + if err != nil && !strings.Contains(err.Error(), "The system cannot find the file specified.") { + t.Error(err) + } + cfg.DataSettings.CSVData = nil + cfg.DataSettings.LiveData = &config.LiveData{ + APIKeyOverride: "test", + APISecretOverride: "test", + APIClientIDOverride: "test", + API2FAOverride: "test", + RealOrders: true, + } + _, err = bt.loadData(cfg, exch, cp, asset.Spot) + if err != nil { + t.Error(err) + } +} + +func TestLoadDatabaseData(t *testing.T) { + t.Parallel() + cp := currency.NewPair(currency.BTC, currency.USDT) + _, err := loadDatabaseData(nil, "", cp, "", -1) + if err != nil && !strings.Contains(err.Error(), "nil config data received") { + t.Error(err) + } + cfg := &config.Config{ + DataSettings: config.DataSettings{ + DatabaseData: &config.DatabaseData{ + StartDate: time.Time{}, + EndDate: time.Time{}, + ConfigOverride: nil, + }, + }, + GoCryptoTraderConfigPath: filepath.Join("..", "..", "testdata", "configtest.json"), + } + _, err = loadDatabaseData(cfg, "", cp, "", -1) + if !errors.Is(err, config.ErrStartEndUnset) { + t.Errorf("expected %v, received %v", config.ErrStartEndUnset, err) + } + cfg.DataSettings.DatabaseData.StartDate = time.Now().Add(-time.Hour) + cfg.DataSettings.DatabaseData.EndDate = time.Now() + _, err = loadDatabaseData(cfg, "", cp, "", -1) + if !errors.Is(err, errIntervalUnset) { + t.Errorf("expected %v, received %v", errIntervalUnset, err) + } + + cfg.DataSettings.Interval = gctkline.OneDay.Duration() + _, err = loadDatabaseData(cfg, "", cp, "", -1) + if err != nil && !strings.Contains(err.Error(), "could not retrieve database data") { + t.Error(err) + } + + cfg.DataSettings.DataType = common.CandleStr + _, err = loadDatabaseData(cfg, "", cp, "", common.DataCandle) + if err != nil && !strings.Contains(err.Error(), "exchange, base, quote, asset, interval, start & end cannot be empty") { + t.Error(err) + } + _, err = loadDatabaseData(cfg, testExchange, cp, asset.Spot, common.DataCandle) + if err != nil && !strings.Contains(err.Error(), "database support is disabled") { + t.Error(err) + } +} + +func TestLoadLiveData(t *testing.T) { + t.Parallel() + err := loadLiveData(nil, nil) + if !errors.Is(err, common.ErrNilArguments) { + t.Error(err) + } + cfg := &config.Config{ + GoCryptoTraderConfigPath: filepath.Join("..", "..", "testdata", "configtest.json"), + } + err = loadLiveData(cfg, nil) + if !errors.Is(err, common.ErrNilArguments) { + t.Error(err) + } + b := &gctexchange.Base{ + Name: testExchange, + API: gctexchange.API{ + AuthenticatedSupport: false, + AuthenticatedWebsocketSupport: false, + PEMKeySupport: false, + Credentials: struct { + Key string + Secret string + ClientID string + PEMKey string + }{}, + CredentialsValidator: struct { + RequiresPEM bool + RequiresKey bool + RequiresSecret bool + RequiresClientID bool + RequiresBase64DecodeSecret bool + }{ + RequiresPEM: true, + RequiresKey: true, + RequiresSecret: true, + RequiresClientID: true, + RequiresBase64DecodeSecret: true, + }, + }, + } + err = loadLiveData(cfg, b) + if !errors.Is(err, common.ErrNilArguments) { + t.Error(err) + } + cfg.DataSettings.LiveData = &config.LiveData{ + + RealOrders: true, + } + cfg.DataSettings.Interval = gctkline.OneDay.Duration() + cfg.DataSettings.DataType = common.CandleStr + err = loadLiveData(cfg, b) + if err != nil { + t.Error(err) + } + + cfg.DataSettings.LiveData.APIKeyOverride = "1234" + cfg.DataSettings.LiveData.APISecretOverride = "1234" + cfg.DataSettings.LiveData.APIClientIDOverride = "1234" + cfg.DataSettings.LiveData.API2FAOverride = "1234" + err = loadLiveData(cfg, b) + if err != nil { + t.Error(err) + } +} + +func TestReset(t *testing.T) { + t.Parallel() + bt := BackTest{ + Bot: &engine.Engine{}, + shutdown: make(chan struct{}), + Datas: &data.HandlerPerCurrency{}, + Strategy: &dollarcostaverage.Strategy{}, + Portfolio: &portfolio.Portfolio{}, + Exchange: &exchange.Exchange{}, + Statistic: &statistics.Statistic{}, + EventQueue: &eventholder.Holder{}, + Reports: &report.Data{}, + } + bt.Reset() + if bt.Bot != nil { + t.Error("expected nil") + } +} + +func TestFullCycle(t *testing.T) { + t.Parallel() + ex := testExchange + cp := currency.NewPair(currency.BTC, currency.USD) + a := asset.Spot + tt := time.Now() + + stats := &statistics.Statistic{} + stats.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + stats.ExchangeAssetPairStatistics[ex] = make(map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + stats.ExchangeAssetPairStatistics[ex][a] = make(map[currency.Pair]*currencystatistics.CurrencyStatistic) + + port, err := portfolio.Setup(&size.Size{ + BuySide: config.MinMax{}, + SellSide: config.MinMax{}, + }, &risk.Risk{}, 0) + if err != nil { + t.Error(err) + } + _, err = port.SetupCurrencySettingsMap(ex, a, cp) + if err != nil { + t.Error(err) + } + err = port.SetInitialFunds(ex, a, cp, 1333337) + if err != nil { + t.Error(err) + } + bot, _ := newBotWithExchange() + + bt := BackTest{ + Bot: bot, + shutdown: nil, + Datas: &data.HandlerPerCurrency{}, + Strategy: &dollarcostaverage.Strategy{}, + Portfolio: port, + Exchange: &exchange.Exchange{}, + Statistic: stats, + EventQueue: &eventholder.Holder{}, + Reports: &report.Data{}, + } + + bt.Datas.Setup() + k := kline.DataFromKline{ + Item: gctkline.Item{ + Exchange: ex, + Pair: cp, + Asset: a, + Interval: gctkline.FifteenMin, + Candles: []gctkline.Candle{{ + Time: tt, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }}, + }, + Base: data.Base{}, + Range: gctkline.IntervalRangeHolder{ + Start: gctkline.CreateIntervalTime(tt), + End: gctkline.CreateIntervalTime(tt.Add(gctkline.FifteenMin.Duration())), + Ranges: []gctkline.IntervalRange{ + { + Start: gctkline.CreateIntervalTime(tt), + End: gctkline.CreateIntervalTime(tt.Add(gctkline.FifteenMin.Duration())), + Intervals: []gctkline.IntervalData{ + { + Start: gctkline.CreateIntervalTime(tt), + End: gctkline.CreateIntervalTime(tt.Add(gctkline.FifteenMin.Duration())), + HasData: true, + }, + }, + }, + }, + }, + } + err = k.Load() + if err != nil { + t.Error(err) + } + bt.Datas.SetDataForCurrency(ex, a, cp, &k) + + err = bt.Run() + if err != nil { + t.Error(err) + } +} + +func TestStop(t *testing.T) { + t.Parallel() + bt := BackTest{shutdown: make(chan struct{})} + bt.Stop() +} + +func TestFullCycleMulti(t *testing.T) { + t.Parallel() + ex := testExchange + cp := currency.NewPair(currency.BTC, currency.USD) + a := asset.Spot + tt := time.Now() + + stats := &statistics.Statistic{} + stats.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + stats.ExchangeAssetPairStatistics[ex] = make(map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + stats.ExchangeAssetPairStatistics[ex][a] = make(map[currency.Pair]*currencystatistics.CurrencyStatistic) + + port, err := portfolio.Setup(&size.Size{ + BuySide: config.MinMax{}, + SellSide: config.MinMax{}, + }, &risk.Risk{}, 0) + if err != nil { + t.Error(err) + } + _, err = port.SetupCurrencySettingsMap(ex, a, cp) + if err != nil { + t.Error(err) + } + err = port.SetInitialFunds(ex, a, cp, 1333337) + if err != nil { + t.Error(err) + } + bot, _ := newBotWithExchange() + + bt := BackTest{ + Bot: bot, + shutdown: nil, + Datas: &data.HandlerPerCurrency{}, + Portfolio: port, + Exchange: &exchange.Exchange{}, + Statistic: stats, + EventQueue: &eventholder.Holder{}, + Reports: &report.Data{}, + } + + bt.Strategy, err = strategies.LoadStrategyByName(dollarcostaverage.Name, true) + if err != nil { + t.Error(err) + } + + bt.Datas.Setup() + k := kline.DataFromKline{ + Item: gctkline.Item{ + Exchange: ex, + Pair: cp, + Asset: a, + Interval: gctkline.FifteenMin, + Candles: []gctkline.Candle{{ + Time: tt, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }}, + }, + Base: data.Base{}, + Range: gctkline.IntervalRangeHolder{ + Start: gctkline.CreateIntervalTime(tt), + End: gctkline.CreateIntervalTime(tt.Add(gctkline.FifteenMin.Duration())), + Ranges: []gctkline.IntervalRange{ + { + Start: gctkline.CreateIntervalTime(tt), + End: gctkline.CreateIntervalTime(tt.Add(gctkline.FifteenMin.Duration())), + Intervals: []gctkline.IntervalData{ + { + Start: gctkline.CreateIntervalTime(tt), + End: gctkline.CreateIntervalTime(tt.Add(gctkline.FifteenMin.Duration())), + HasData: true, + }, + }, + }, + }, + }, + } + err = k.Load() + if err != nil { + t.Error(err) + } + + bt.Datas.SetDataForCurrency(ex, a, cp, &k) + + err = bt.Run() + if err != nil { + t.Error(err) + } +} diff --git a/backtester/backtest/backtest_types.go b/backtester/backtest/backtest_types.go new file mode 100644 index 00000000..59722dc5 --- /dev/null +++ b/backtester/backtest/backtest_types.go @@ -0,0 +1,40 @@ +package backtest + +import ( + "errors" + + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/eventholder" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies" + "github.com/thrasher-corp/gocryptotrader/backtester/report" + "github.com/thrasher-corp/gocryptotrader/engine" +) + +var ( + errNilConfig = errors.New("unable to setup backtester with nil config") + errNilBot = errors.New("unable to setup backtester without a loaded GoCryptoTrader bot") + errInvalidConfigAsset = errors.New("invalid asset in config") + errInvalidConfigCurrency = errors.New("invalid currency in config") + errAmbiguousDataSource = errors.New("ambiguous settings received. Only one data type can be set") + errNoDataSource = errors.New("no data settings set in config") + errIntervalUnset = errors.New("candle interval unset") + errUnhandledDatatype = errors.New("unhandled datatype") + errLiveDataTimeout = errors.New("no data returned in 5 minutes, shutting down") +) + +// BackTest is the main holder of all backtesting functionality +type BackTest struct { + Bot *engine.Engine + hasHandledEvent bool + shutdown chan struct{} + Datas data.Holder + Strategy strategies.Handler + Portfolio portfolio.Handler + Exchange exchange.ExecutionHandler + Statistic statistics.Handler + EventQueue eventholder.EventHolder + Reports report.Handler +} diff --git a/backtester/common/README.md b/backtester/common/README.md new file mode 100644 index 00000000..78cc6917 --- /dev/null +++ b/backtester/common/README.md @@ -0,0 +1,44 @@ +# GoCryptoTrader Backtester: Common package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/common) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This common package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Common package overview + +Common contains some basic data types which are used throughout. + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/common/backtester.png b/backtester/common/backtester.png new file mode 100644 index 0000000000000000000000000000000000000000..06d4547d8f4b3837bb490e5a3447fa00aa07da31 GIT binary patch literal 86130 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

UtvdoG{vZE4_cW`L=+bbb}(M@D} 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 z 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 IcKzP}18Q8Ve*gdg literal 0 HcmV?d00001 diff --git a/backtester/common/common.go b/backtester/common/common.go new file mode 100644 index 00000000..ccb5c4d2 --- /dev/null +++ b/backtester/common/common.go @@ -0,0 +1,15 @@ +package common + +import "fmt" + +// DataTypeToInt converts the config string value into an int +func DataTypeToInt(dataType string) (int64, error) { + switch dataType { + case CandleStr: + return DataCandle, nil + case TradeStr: + return DataTrade, nil + default: + return 0, fmt.Errorf("unrecognised dataType '%v'", dataType) + } +} diff --git a/backtester/common/common_types.go b/backtester/common/common_types.go new file mode 100644 index 00000000..609d25c1 --- /dev/null +++ b/backtester/common/common_types.go @@ -0,0 +1,107 @@ +package common + +import ( + "errors" + "time" + + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const ( + // DoNothing is an explicit signal for the backtester to not perform an action + // based upon indicator results + DoNothing order.Side = "DO NOTHING" + // CouldNotBuy is flagged when a BUY signal is raised in the strategy/signal phase, but the + // portfolio manager or exchange cannot place an order + CouldNotBuy order.Side = "COULD NOT BUY" + // CouldNotSell is flagged when a SELL signal is raised in the strategy/signal phase, but the + // portfolio manager or exchange cannot place an order + CouldNotSell order.Side = "COULD NOT SELL" + // MissingData is signalled during the strategy/signal phase when data has been identified as missing + // No buy or sell events can occur + MissingData order.Side = "MISSING DATA" + // CandleStr is a config readable data type to tell the backtester to retrieve candle data + CandleStr = "candle" + // TradeStr is a config readable data type to tell the backtester to retrieve trade data + TradeStr = "trade" +) + +// DataCandle is an int64 representation of a candle data type +const ( + DataCandle = iota + DataTrade +) + +var ( + // ErrNilArguments is a common error response to highlight that nils were passed in + // when they should not have been + ErrNilArguments = errors.New("received nil argument(s)") + ErrNilEvent = errors.New("nil event received") +) + +// EventHandler interface implements required GetTime() & Pair() return +type EventHandler interface { + GetOffset() int64 + SetOffset(int64) + IsEvent() bool + GetTime() time.Time + Pair() currency.Pair + GetExchange() string + GetInterval() kline.Interval + GetAssetType() asset.Item + + GetReason() string + AppendReason(string) +} + +// DataEventHandler interface used for loading and interacting with Data +type DataEventHandler interface { + EventHandler + ClosePrice() float64 + HighPrice() float64 + LowPrice() float64 + OpenPrice() float64 +} + +// Directioner dictates the side of an order +type Directioner interface { + SetDirection(side order.Side) + GetDirection() order.Side +} + +// ASCIILogo is a sweet logo that is optionally printed to the command line window +const ASCIILogo = ` + + @@@@@@@@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@ ,,,,,, + @@@@@@@@,,,,, @@@@@@@@@,,,,,,,, + @@@@@@@@,,,,,,, @@@@@@@,,,,,,, + @@@@@@(,,,,,,,, ,,@@@@@@@,,,,,, + ,,@@@@@@,,,,,,,,, #,,,,,,,,,,,,,,,,, + ,,,,*@@@@@@,,,,,,,,,,,,,,,,,,,,,,,,,,%%%%%%% + ,,,,,,,*@@@@@@,,,,,,,,,,,,,,%%%%%,,,,,,%%%%%%%% + ,,,,,,,,*@@@@@@,,,,,,,,,,,%%%%%%%%%%%%%%%%%%#%% + ,,,,,,*@@@@@@,,,,,,,,,%%%,,,,,%%%%%%%%,,,,, + ,,,*@@@@@@,,,,,,%%, ,,,,,,,@*%%,@,,,,,, + *@@@@@@,,,,,,,,, ,,,,@@@@@@,,,,,, + @@@@@@,,,,,,,,, @@@@@@@,,,,,, + @@@@@@@@,,,,,,, @@@@@@@,,,,,,, + @@@@@@@@@,,,, @@@@@@@@@#,,,,,,, + @@@@@@@@@@@@@@@@@@@@@@@ *,,,, + @@@@@@@@@@@@@@@@ + + ______ ______ __ ______ __ + / ____/___ / ____/______ ______ / /_____/_ __/________ _____/ /__ _____ + / / __/ __ \/ / / ___/ / / / __ \/ __/ __ \/ / / ___/ __ / __ / _ \/ ___/ +/ /_/ / /_/ / /___/ / / /_/ / /_/ / /_/ /_/ / / / / / /_/ / /_/ / __/ / +\____/\____/\____/_/ \__, / .___/\__/\____/_/ /_/ \__,_/\__,_/\___/_/ + /___/ + ____ __ __ __ + / __ )____ ______/ /__/ /____ _____/ /____ _____ + / __ / __ / ___/ //_/ __/ _ \/ ___/ __/ _ \/ ___/ + / /_/ / /_/ / /__/ ,< / /_/ __(__ ) /_/ __/ / + /_____/\__,_/\___/_/|_|\__/\___/____/\__/\___/_/ +` diff --git a/backtester/config/README.md b/backtester/config/README.md new file mode 100644 index 00000000..4b7c024f --- /dev/null +++ b/backtester/config/README.md @@ -0,0 +1,167 @@ +# GoCryptoTrader Backtester: Config package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/config) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This config package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Config package overview + +### What does the config package do? +The config package contains a set of structs which allow for the customisation of the GoCryptoTrader Backtester when running. +The GoCryptoTrader Backtester runs from reading config files (`.strat` files by default under `/examples`). + + +### What does Simultaneous Processing mean? +GoCryptoTrader Backtester config files may contain multiple `ExchangeSettings` which defined exchange, asset and currency pairs to iterate through a period of time. + +If there are multiple entries to `ExchangeSettings` and SimultaneousProcessing is disabled, then each individual exchange, asset and currency pair candle event is evaluated individually and does not know about other exchange, asset and currency pair data events. It is a way to test a singular strategy against multiple assets simultaneously. But it isn't defined as Simultaneous Processing +Simultaneous Signal Processing is a setting which allows multiple `ExchangeSettings` data events for a candle event to be considered simultaneously. This means that you can check if the price of BTC-USDT is 5% greater on Binance than it is on Kraken and choose to make signal a BUY event for Kraken and not Binance. + +It allows for complex strategical decisions to be made when you consider the scope of the entire market at a given time, rather than in a vacuum when SimultaneousSignalProcessing is disabled. + +### How do I customise the GoCryptoTrader Backtester? +See below for a set of tables and fields, expected values and what they can do + +#### Config + +| Key | Description | +| --- | ------| +| Nickname | A nickname for the specific config. When running multiple variants of the same strategy, use the nickname to help differentiate between runs | +| Goal | A description of what you would hope the outcome to be. When verifying output, you can review and confirm whether the strategy met that goal | +| CurrencySettings | Currency settings is an array of settings for each individual currency you wish to run the strategy against. | +| StrategySettings | Select which strategy to run, what custom settings to load and whether the strategy can assess multiple currencies at once to make more in-depth decisions | +| PortfolioSettings | Contains a list of global rules for the portfolio manager. CurrencySettings contain their own rules on things like how big a position is allowable, the portfolio manager rules are the same, but override any individual currency's settings | +| StatisticSettings | Contains settings that impact statistics calculation. Such as the risk-free rate for the sharpe ratio | +| GoCryptoTraderConfigPath | The filepath for the location of GoCryptoTrader's config path. The Backtester utilises settings from GoCryptoTrader. If unset, will utilise the default filepath via `config.DefaultFilePath`, implemented [here](/config/config.go#L1460) | + +#### Currency Settings + +| Key | Description | Example | +| --- | ------- | ----- | +| ExchangeName | The exchange to load. See [here](https://github.com/thrasher-corp/gocryptotrader/blob/master/README.md) for a list of supported exchanges | `Binance` | +| Asset | The asset type. Typically, this will be `spot`, however, see [this package](https://github.com/thrasher-corp/gocryptotrader/blob/master/exchanges/asset/asset.go) for the various asset types GoCryptoTrader supports| `spot` | +| Base | The base of a currency | `BTC` | +| Quote | The quote of a currency | `USDT` | +| InitialFunds | The funds that the GoCryptoTraderBacktester has for the specific currency | `10000` | +| Leverage | This struct defines the leverage rules that this specific currency setting must abide by | `1` | +| BuySide | This struct defines the buying side rules this specific currency setting must abide by such as maximum purchase amount | - | +| SellSide | This struct defines the selling side rules this specific currency setting must abide by such as maximum selling amount | - | +| MinimumSlippagePercent | Is the lower bounds in a random number generated that make purchases more expensive, or sell events less valuable. If this value is 90, then the most a price can be affected is 10% | `90` | +| MaximumSlippagePercent | Is the upper bounds in a random number generated that make purchases more expensive, or sell events less valuable. If this value is 99, then the least a price can be affected is 1%. Set both upper and lower to 100 to have no randomness applied to purchase events | `100` | +| MakerFee | The fee to use when sizing and purchasing currency | `0.001` | +| TakerFee | Unused fee for when an order is placed in the orderbook, rather than taken from the orderbook | `0.002` | +| MaximumHoldingsRatio | When multiple currency settings are used, you may set a maximum holdings ratio to prevent having too large a stake in a single currency | `0.5` | + +#### Strategy Settings + +| Key | Description | Example | +| --- | ------- | --- | +| Name | The strategy to use. | `rsi` | +| UsesSimultaneousProcessing | This denotes whether multiple currencies are processed simultaneously with the strategy function `OnSimultaneousSignals`. Eg If you have multiple CurrencySettings and only wish to purchase BTC-USDT when XRP-DOGE is 1337, this setting is useful as you can analyse both signal events to output a purchase call for BTC. | `true` | +| CustomSettings | This is a map where you can enter custom settings for a strategy. The RSI strategy allows for customisation of the upper, lower and length variables to allow you to change them from 70, 30 and 14 respectively to 69, 36, 12 | `"custom-settings": { "rsi-high": 70, "rsi-low": 30, "rsi-period": 14 } ` | + +#### PortfolioSettings + +| Key | Description | +| --- | ------- | +| Leverage | This struct defines the leverage rules that this specific currency setting must abide by | +| BuySide | This struct defines the buying side rules this specific currency setting must abide by such as maximum purchase amount | +| SellSide | This struct defines the selling side rules this specific currency setting must abide by such as maximum selling amount | + +#### StatisticsSettings + +| Key | Description | Example | +| --- | ----------- | ------- | +| RiskFreeRate | The risk free rate used in the calculation of sharpe and sortino ratios | `0.03` | + +#### APIData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `trade` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| StartDate | The start date to retrieve data | `2021-01-23T11:00:00+11:00` | +| EndDate | The end date to retrieve data | `2021-01-24T11:00:00+11:00` | +| InclusiveEndDate | When enabled, the end date's candle is included in the results. ie `2021-01-24T11:00:00+11:00` with a one hour candle, the final candle will be `2021-01-24T11:00:00+11:00` to `2021-01-24T12:00:00+11:00` | `false` | + +#### CSVData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `candle` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| FullPath | The file to load | `/data/exchangelist.csv` | + +#### DatabaseData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `trade` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| StartDate | The start date to retrieve data | `2021-01-23T11:00:00+11:00` | +| EndDate | The end date to retrieve data | `2021-01-24T11:00:00+11:00` | +| ConfigOverride | Override GoCryptoTrader's config database data with custom settings | `true` | +| InclusiveEndDate | When enabled, the end date's candle is included in the results. ie `2021-01-24T11:00:00+11:00` with a one hour candle, the final candle will be `2021-01-24T11:00:00+11:00` to `2021-01-24T12:00:00+11:00` | `false` | + +#### LiveData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `candle` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| APIKeyOverride | Will set the GoCryptoTrader exchange to use the following API Key | `1234` | +| APISecretOverride | Will set the GoCryptoTrader exchange to use the following API Secret | `5678` | +| APIClientIDOverride | Will set the GoCryptoTrader exchange to use the following API Client ID | `9012` | +| API2FAOverride | Will set the GoCryptoTrader exchange to use the following 2FA seed | `hello-moto` | +| RealOrders | Whether to place real orders. You really should never consider using this. Ever ever. | `true` | + +##### Leverage Settings + +| Key | Description | Example | +| --- | ----------- | ------- | +| CanUseLeverage | Allows the use of leverage | `false` | +| MaximumOrdersWithLeverageRatio | If the ratio of leveraged orders for a currency exceeds this, the order cannot be placed | `0.5` | +| MaximumLeverageRate | Orders cannot be placed with leverage over this amount | `100` | + +##### Buy/Sell Settings + +| Key | Description | Example | +| --- | ----------- | ------- | +| MinimumSize | If the order's quantity is below this, the order cannot be placed | `0.1` | +| MaximumSize | If the order's quantity is over this amount, it cannot be placed and will be reduced to the maximum amount | `10` | +| MaximumTotal | If the order's price * amount exceeds this number, the order cannot be placed and will be reduced to this figure | `1337` | + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/config/config.go b/backtester/config/config.go new file mode 100644 index 00000000..3942ea63 --- /dev/null +++ b/backtester/config/config.go @@ -0,0 +1,183 @@ +package config + +import ( + "encoding/json" + "errors" + "fmt" + "io/ioutil" + + gctcommon "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/common/file" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// ReadConfigFromFile will take a config from a path +func ReadConfigFromFile(path string) (*Config, error) { + if !file.Exists(path) { + return nil, errors.New("file not found") + } + + fileData, err := ioutil.ReadFile(path) + if err != nil { + return nil, err + } + + return LoadConfig(fileData) +} + +// LoadConfig unmarshalls byte data into a config struct +func LoadConfig(data []byte) (resp *Config, err error) { + err = json.Unmarshal(data, &resp) + return resp, err +} + +// PrintSetting prints relevant settings to the console for easy reading +func (c *Config) PrintSetting() { + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Info(log.BackTester, "------------------Backtester Settings------------------------") + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Info(log.BackTester, "------------------Strategy Settings--------------------------") + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Infof(log.BackTester, "Strategy: %s", c.StrategySettings.Name) + if len(c.StrategySettings.CustomSettings) > 0 { + log.Info(log.BackTester, "Custom strategy variables:") + for k, v := range c.StrategySettings.CustomSettings { + log.Infof(log.BackTester, "%s: %v", k, v) + } + } else { + log.Info(log.BackTester, "Custom strategy variables: unset") + } + log.Infof(log.BackTester, "Simultaneous Signal Processing: %v", c.StrategySettings.SimultaneousSignalProcessing) + for i := range c.CurrencySettings { + log.Info(log.BackTester, "-------------------------------------------------------------") + currStr := fmt.Sprintf("------------------%v %v-%v Settings---------------------------------------------------------", + c.CurrencySettings[i].Asset, + c.CurrencySettings[i].Base, + c.CurrencySettings[i].Quote) + log.Infof(log.BackTester, currStr[:61]) + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Infof(log.BackTester, "Exchange: %v", c.CurrencySettings[i].ExchangeName) + log.Infof(log.BackTester, "Initial funds: %.4f", c.CurrencySettings[i].InitialFunds) + log.Infof(log.BackTester, "Maker fee: %.2f", c.CurrencySettings[i].TakerFee) + log.Infof(log.BackTester, "Taker fee: %.2f", c.CurrencySettings[i].MakerFee) + log.Infof(log.BackTester, "Minimum slippage percent %.2f", c.CurrencySettings[i].MinimumSlippagePercent) + log.Infof(log.BackTester, "Maximum slippage percent: %.2f", c.CurrencySettings[i].MaximumSlippagePercent) + log.Infof(log.BackTester, "Buy rules: %+v", c.CurrencySettings[i].BuySide) + log.Infof(log.BackTester, "Sell rules: %+v", c.CurrencySettings[i].SellSide) + log.Infof(log.BackTester, "Leverage rules: %+v", c.CurrencySettings[i].Leverage) + } + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Info(log.BackTester, "------------------Portfolio Settings-------------------------") + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Infof(log.BackTester, "Buy rules: %+v", c.PortfolioSettings.BuySide) + log.Infof(log.BackTester, "Sell rules: %+v", c.PortfolioSettings.SellSide) + log.Infof(log.BackTester, "Leverage rules: %+v", c.PortfolioSettings.Leverage) + if c.DataSettings.LiveData != nil { + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Info(log.BackTester, "------------------Live Settings------------------------------") + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Infof(log.BackTester, "Data type: %v", c.DataSettings.DataType) + log.Infof(log.BackTester, "Interval: %v", c.DataSettings.Interval) + log.Infof(log.BackTester, "REAL ORDERS: %v", c.DataSettings.LiveData.RealOrders) + log.Infof(log.BackTester, "Overriding GCT API settings: %v", c.DataSettings.LiveData.APIClientIDOverride != "") + } + if c.DataSettings.APIData != nil { + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Info(log.BackTester, "------------------API Settings-------------------------------") + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Infof(log.BackTester, "Data type: %v", c.DataSettings.DataType) + log.Infof(log.BackTester, "Interval: %v", c.DataSettings.Interval) + log.Infof(log.BackTester, "Start date: %v", c.DataSettings.APIData.StartDate.Format(gctcommon.SimpleTimeFormat)) + log.Infof(log.BackTester, "End date: %v", c.DataSettings.APIData.EndDate.Format(gctcommon.SimpleTimeFormat)) + } + if c.DataSettings.CSVData != nil { + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Info(log.BackTester, "------------------CSV Settings-------------------------------") + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Infof(log.BackTester, "Data type: %v", c.DataSettings.DataType) + log.Infof(log.BackTester, "Interval: %v", c.DataSettings.Interval) + log.Infof(log.BackTester, "CSV file: %v", c.DataSettings.CSVData.FullPath) + } + if c.DataSettings.DatabaseData != nil { + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Info(log.BackTester, "------------------Database Settings--------------------------") + log.Info(log.BackTester, "-------------------------------------------------------------") + log.Infof(log.BackTester, "Data type: %v", c.DataSettings.DataType) + log.Infof(log.BackTester, "Interval: %v", c.DataSettings.Interval) + log.Infof(log.BackTester, "Start date: %v", c.DataSettings.DatabaseData.StartDate.Format(gctcommon.SimpleTimeFormat)) + log.Infof(log.BackTester, "End date: %v", c.DataSettings.DatabaseData.EndDate.Format(gctcommon.SimpleTimeFormat)) + } + log.Info(log.BackTester, "-------------------------------------------------------------\n\n") +} + +// Validate ensures no one sets bad config values on purpose +func (m *MinMax) Validate() { + if m.MaximumSize < 0 { + m.MaximumSize *= -1 + log.Warnf(log.BackTester, "invalid maximum size set to %v", m.MaximumSize) + } + if m.MinimumSize < 0 { + m.MinimumSize *= -1 + log.Warnf(log.BackTester, "invalid minimum size set to %v", m.MinimumSize) + } + if m.MaximumSize <= m.MinimumSize && m.MinimumSize != 0 && m.MaximumSize != 0 { + m.MaximumSize = m.MinimumSize + 1 + log.Warnf(log.BackTester, "invalid maximum size set to %v", m.MaximumSize) + } + if m.MaximumTotal < 0 { + m.MaximumTotal *= -1 + log.Warnf(log.BackTester, "invalid maximum total set to %v", m.MaximumTotal) + } +} + +// ValidateDate checks whether someone has set a date poorly in their config +func (c *Config) ValidateDate() error { + if c.DataSettings.DatabaseData != nil { + if c.DataSettings.DatabaseData.StartDate.IsZero() || + c.DataSettings.DatabaseData.EndDate.IsZero() { + return ErrStartEndUnset + } + if c.DataSettings.DatabaseData.StartDate.After(c.DataSettings.DatabaseData.EndDate) || + c.DataSettings.DatabaseData.StartDate.Equal(c.DataSettings.DatabaseData.EndDate) { + return ErrBadDate + } + } + if c.DataSettings.APIData != nil { + if c.DataSettings.APIData.StartDate.IsZero() || + c.DataSettings.APIData.EndDate.IsZero() { + return ErrStartEndUnset + } + if c.DataSettings.APIData.StartDate.After(c.DataSettings.APIData.EndDate) || + c.DataSettings.APIData.StartDate.Equal(c.DataSettings.APIData.EndDate) { + return ErrBadDate + } + } + return nil +} + +// ValidateCurrencySettings checks whether someone has set invalid currency setting data in their config +func (c *Config) ValidateCurrencySettings() error { + if len(c.CurrencySettings) == 0 { + return ErrNoCurrencySettings + } + for i := range c.CurrencySettings { + if c.CurrencySettings[i].InitialFunds <= 0 { + return ErrBadInitialFunds + } + if c.CurrencySettings[i].Base == "" { + return ErrUnsetCurrency + } + if c.CurrencySettings[i].Asset == "" { + return ErrUnsetAsset + } + if c.CurrencySettings[i].ExchangeName == "" { + return ErrUnsetExchange + } + if c.CurrencySettings[i].MinimumSlippagePercent < 0 || + c.CurrencySettings[i].MaximumSlippagePercent < 0 || + c.CurrencySettings[i].MinimumSlippagePercent > c.CurrencySettings[i].MaximumSlippagePercent { + return ErrBadSlippageRates + } + } + return nil +} diff --git a/backtester/config/config_test.go b/backtester/config/config_test.go new file mode 100644 index 00000000..a928f2a9 --- /dev/null +++ b/backtester/config/config_test.go @@ -0,0 +1,1005 @@ +package config + +import ( + "encoding/json" + "errors" + "io/ioutil" + "os" + "path/filepath" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/database" + "github.com/thrasher-corp/gocryptotrader/database/drivers" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +const ( + makerFee = 0.001 + takerFee = 0.002 + testExchange = "binance" + dca = "dollarcostaverage" + // change this if you modify a config and want it to save to the example folder + saveConfig = false +) + +var ( + startDate time.Time + endDate time.Time +) + +func TestMain(m *testing.M) { + startDate = time.Date(time.Now().Year()-1, 11, 1, 0, 0, 0, 0, time.Local) + endDate = time.Date(time.Now().Year()-1, 12, 1, 0, 0, 0, 0, time.Local) + os.Exit(m.Run()) +} + +func TestLoadConfig(t *testing.T) { + _, err := LoadConfig([]byte(`{}`)) + if err != nil { + t.Error(err) + } +} + +func TestReadConfigFromFile(t *testing.T) { + tempDir, err := ioutil.TempDir("", "") + if err != nil { + t.Fatalf("Problem creating temp dir at %s: %s\n", tempDir, err) + } + defer func() { + err = os.RemoveAll(tempDir) + if err != nil { + t.Error(err) + } + }() + var passFile *os.File + passFile, err = ioutil.TempFile(tempDir, "*.start") + if err != nil { + t.Fatalf("Problem creating temp file at %v: %s\n", passFile, err) + } + _, err = passFile.WriteString("{}") + if err != nil { + t.Error(err) + } + err = passFile.Close() + if err != nil { + t.Error(err) + } + _, err = ReadConfigFromFile(passFile.Name()) + if err != nil { + t.Error(err) + } +} + +func TestPrintSettings(t *testing.T) { + cfg := Config{ + Nickname: "super fun run", + Goal: "To demonstrate rendering of settings", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneMin.Duration(), + DataType: common.CandleStr, + APIData: &APIData{ + StartDate: startDate, + EndDate: endDate, + InclusiveEndDate: true, + }, + CSVData: &CSVData{ + FullPath: "fake", + }, + LiveData: &LiveData{ + APIKeyOverride: "", + APISecretOverride: "", + APIClientIDOverride: "", + API2FAOverride: "", + RealOrders: false, + }, + DatabaseData: &DatabaseData{ + StartDate: startDate, + EndDate: endDate, + ConfigOverride: nil, + InclusiveEndDate: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + cfg.PrintSetting() +} + +func TestGenerateConfigForDCAAPICandles(t *testing.T) { + cfg := Config{ + Nickname: "TestGenerateConfigForDCAAPICandles", + Goal: "To demonstrate DCA strategy using API candles", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneDay.Duration(), + DataType: common.CandleStr, + APIData: &APIData{ + StartDate: startDate, + EndDate: endDate, + InclusiveEndDate: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-api-candles.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForDCAAPITrades(t *testing.T) { + cfg := Config{ + Nickname: "TestGenerateConfigForDCAAPITrades", + Goal: "To demonstrate running the DCA strategy using API trade data", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneDay.Duration(), + DataType: common.TradeStr, + APIData: &APIData{ + StartDate: startDate, + EndDate: endDate, + InclusiveEndDate: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-api-trades.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForDCAAPICandlesMultipleCurrencies(t *testing.T) { + cfg := Config{ + Nickname: "TestGenerateConfigForDCAAPICandlesMultipleCurrencies", + Goal: "To demonstrate running the DCA strategy using the API against multiple currencies candle data", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.ETH.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneDay.Duration(), + DataType: common.CandleStr, + APIData: &APIData{ + StartDate: startDate, + EndDate: endDate, + InclusiveEndDate: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-api-candles-multiple-currencies.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForDCAAPICandlesSimultaneousProcessing(t *testing.T) { + cfg := Config{ + Nickname: "TestGenerateConfigForDCAAPICandlesSimultaneousProcessing", + Goal: "To demonstrate how simultaneous processing can work", + StrategySettings: StrategySettings{ + Name: dca, + SimultaneousSignalProcessing: true, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 1000000, + BuySide: MinMax{ + MinimumSize: 0, + MaximumSize: 0, + MaximumTotal: 1000, + }, + SellSide: MinMax{ + MinimumSize: 0, + MaximumSize: 0, + MaximumTotal: 1000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.ETH.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneDay.Duration(), + DataType: common.CandleStr, + APIData: &APIData{ + StartDate: startDate, + EndDate: endDate, + InclusiveEndDate: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-api-candles-simultaneous-processing.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForDCALiveCandles(t *testing.T) { + cfg := Config{ + Nickname: "TestGenerateConfigForDCALiveCandles", + Goal: "To demonstrate live trading proof of concept against candle data", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneHour.Duration(), + DataType: common.CandleStr, + LiveData: &LiveData{ + APIKeyOverride: "", + APISecretOverride: "", + APIClientIDOverride: "", + API2FAOverride: "", + RealOrders: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-candles-live.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForRSIAPICustomSettings(t *testing.T) { + cfg := Config{ + Nickname: "TestGenerateRSICandleAPICustomSettingsStrat", + Goal: "To demonstrate the RSI strategy using API candle data and custom settings", + StrategySettings: StrategySettings{ + Name: "rsi", + CustomSettings: map[string]interface{}{ + "rsi-low": 30.0, + "rsi-high": 70.0, + "rsi-period": 14, + }, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 1000000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.ETH.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneDay.Duration(), + DataType: common.CandleStr, + APIData: &APIData{ + StartDate: startDate, + EndDate: endDate, + InclusiveEndDate: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "rsi-api-candles.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForDCACSVCandles(t *testing.T) { + fp := filepath.Join("..", "testdata", "binance_BTCUSDT_24h_2019_01_01_2020_01_01.csv") + cfg := Config{ + Nickname: "TestGenerateConfigForDCACSVCandles", + Goal: "To demonstrate the DCA strategy using CSV candle data", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneDay.Duration(), + DataType: common.CandleStr, + CSVData: &CSVData{ + FullPath: fp, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-csv-candles.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForDCACSVTrades(t *testing.T) { + fp := filepath.Join("..", "testdata", "binance_BTCUSDT_24h-trades_2020_11_16.csv") + cfg := Config{ + Nickname: "TestGenerateConfigForDCACSVTrades", + Goal: "To demonstrate the DCA strategy using CSV trade data", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneMin.Duration(), + DataType: common.TradeStr, + CSVData: &CSVData{ + FullPath: fp, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-csv-trades.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestGenerateConfigForDCADatabaseCandles(t *testing.T) { + cfg := Config{ + Nickname: "TestGenerateConfigForDCADatabaseCandles", + Goal: "To demonstrate the DCA strategy using database candle data", + StrategySettings: StrategySettings{ + Name: dca, + }, + CurrencySettings: []CurrencySettings{ + { + ExchangeName: testExchange, + Asset: asset.Spot.String(), + Base: currency.BTC.String(), + Quote: currency.USDT.String(), + InitialFunds: 100000, + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + MakerFee: makerFee, + TakerFee: takerFee, + }, + }, + DataSettings: DataSettings{ + Interval: kline.OneDay.Duration(), + DataType: common.CandleStr, + DatabaseData: &DatabaseData{ + StartDate: startDate, + EndDate: endDate, + ConfigOverride: &database.Config{ + Enabled: true, + Verbose: false, + Driver: "sqlite", + ConnectionDetails: drivers.ConnectionDetails{ + Host: "localhost", + Database: "testsqlite.db", + }, + }, + InclusiveEndDate: false, + }, + }, + PortfolioSettings: PortfolioSettings{ + BuySide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + SellSide: MinMax{ + MinimumSize: 0.1, + MaximumSize: 1, + MaximumTotal: 10000, + }, + Leverage: Leverage{ + CanUseLeverage: false, + }, + }, + StatisticSettings: StatisticSettings{ + RiskFreeRate: 0.03, + }, + } + if saveConfig { + result, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + t.Error(err) + } + p, err := os.Getwd() + if err != nil { + t.Error(err) + } + err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-database-candles.strat"), result, 0770) + if err != nil { + t.Error(err) + } + } +} + +func TestValidate(t *testing.T) { + m := MinMax{ + MinimumSize: -1, + MaximumSize: -1, + MaximumTotal: -1, + } + m.Validate() + if m.MinimumSize > m.MaximumSize { + t.Errorf("expected %v > %v", m.MaximumSize, m.MinimumSize) + } + if m.MinimumSize < 0 { + t.Errorf("expected %v > %v", m.MinimumSize, 0) + } + if m.MaximumSize < 0 { + t.Errorf("expected %v > %v", m.MaximumSize, 0) + } + if m.MaximumTotal < 0 { + t.Errorf("expected %v > %v", m.MaximumTotal, 0) + } +} + +func TestValidateDate(t *testing.T) { + c := Config{} + err := c.ValidateDate() + if err != nil { + t.Error(err) + } + c.DataSettings = DataSettings{ + DatabaseData: &DatabaseData{}, + } + err = c.ValidateDate() + if !errors.Is(ErrStartEndUnset, err) { + t.Errorf("expected %v, received %v", ErrStartEndUnset, err) + } + c.DataSettings.DatabaseData.StartDate = time.Now() + c.DataSettings.DatabaseData.EndDate = c.DataSettings.DatabaseData.StartDate + err = c.ValidateDate() + if !errors.Is(ErrBadDate, err) { + t.Errorf("expected %v, received %v", ErrBadDate, err) + } + c.DataSettings.DatabaseData.EndDate = c.DataSettings.DatabaseData.StartDate.Add(time.Minute) + err = c.ValidateDate() + if err != nil { + t.Error(err) + } + c.DataSettings.APIData = &APIData{} + err = c.ValidateDate() + if !errors.Is(ErrStartEndUnset, err) { + t.Errorf("expected %v, received %v", ErrStartEndUnset, err) + } + c.DataSettings.APIData.StartDate = time.Now() + c.DataSettings.APIData.EndDate = c.DataSettings.APIData.StartDate + err = c.ValidateDate() + if !errors.Is(ErrBadDate, err) { + t.Errorf("expected %v, received %v", ErrBadDate, err) + } + c.DataSettings.APIData.EndDate = c.DataSettings.APIData.StartDate.Add(time.Minute) + err = c.ValidateDate() + if err != nil { + t.Error(err) + } +} + +func TestValidateCurrencySettings(t *testing.T) { + c := Config{} + err := c.ValidateCurrencySettings() + if !errors.Is(ErrNoCurrencySettings, err) { + t.Errorf("expected %v, received %v", ErrNoCurrencySettings, err) + } + c.CurrencySettings = append(c.CurrencySettings, CurrencySettings{}) + err = c.ValidateCurrencySettings() + if !errors.Is(ErrBadInitialFunds, err) { + t.Errorf("expected %v, received %v", ErrBadInitialFunds, err) + } + c.CurrencySettings[0].InitialFunds = 1337 + err = c.ValidateCurrencySettings() + if !errors.Is(ErrUnsetCurrency, err) { + t.Errorf("expected %v, received %v", ErrUnsetCurrency, err) + } + c.CurrencySettings[0].Base = "lol" + err = c.ValidateCurrencySettings() + if !errors.Is(ErrUnsetAsset, err) { + t.Errorf("expected %v, received %v", ErrUnsetAsset, err) + } + c.CurrencySettings[0].Asset = "lol" + err = c.ValidateCurrencySettings() + if !errors.Is(ErrUnsetExchange, err) { + t.Errorf("expected %v, received %v", ErrUnsetExchange, err) + } + c.CurrencySettings[0].ExchangeName = "lol" + err = c.ValidateCurrencySettings() + if err != nil { + t.Error(err) + } +} diff --git a/backtester/config/config_types.go b/backtester/config/config_types.go new file mode 100644 index 00000000..fb7de5cb --- /dev/null +++ b/backtester/config/config_types.go @@ -0,0 +1,136 @@ +package config + +import ( + "errors" + "time" + + "github.com/thrasher-corp/gocryptotrader/database" +) + +// Errors for config validation +var ( + ErrBadDate = errors.New("start date >= end date, please check your config") + ErrNoCurrencySettings = errors.New("no currency settings set in the config") + ErrBadInitialFunds = errors.New("initial funds set with invalid data, please check your config") + ErrUnsetExchange = errors.New("exchange name unset for currency settings, please check your config") + ErrUnsetAsset = errors.New("asset unset for currency settings, please check your config") + ErrUnsetCurrency = errors.New("currency unset for currency settings, please check your config") + ErrBadSlippageRates = errors.New("invalid slippage rates in currency settings, please check your config") + ErrStartEndUnset = errors.New("data start and end dates are invalid, please check your config") +) + +// Config defines what is in an individual strategy config +type Config struct { + Nickname string `json:"nickname"` + Goal string `json:"goal"` + StrategySettings StrategySettings `json:"strategy-settings"` + CurrencySettings []CurrencySettings `json:"currency-settings"` + DataSettings DataSettings `json:"data-settings"` + PortfolioSettings PortfolioSettings `json:"portfolio-settings"` + StatisticSettings StatisticSettings `json:"statistic-settings"` + GoCryptoTraderConfigPath string `json:"gocryptotrader-config-path"` +} + +// DataSettings is a container for each type of data retrieval setting. +// Only ONE can be populated per config +type DataSettings struct { + Interval time.Duration `json:"interval"` + DataType string `json:"data-type"` + APIData *APIData `json:"api-data,omitempty"` + DatabaseData *DatabaseData `json:"database-data,omitempty"` + LiveData *LiveData `json:"live-data,omitempty"` + CSVData *CSVData `json:"csv-data,omitempty"` +} + +// StrategySettings contains what strategy to load, along with custom settings map +// (variables defined per strategy) +// along with defining whether the strategy will assess all currencies at once, or individually +type StrategySettings struct { + Name string `json:"name"` + SimultaneousSignalProcessing bool `json:"use-simultaneous-signal-processing"` + CustomSettings map[string]interface{} `json:"custom-settings"` +} + +// StatisticSettings holds configurable varialbes to adjust ratios where +// proper data is currently lacking +type StatisticSettings struct { + RiskFreeRate float64 `json:"risk-free-rate"` +} + +// PortfolioSettings act as a global protector for strategies +// these settings will override ExchangeSettings that go against it +// and assess the bigger picture +type PortfolioSettings struct { + Leverage Leverage `json:"leverage"` + BuySide MinMax `json:"buy-side"` + SellSide MinMax `json:"sell-side"` +} + +// Leverage rules are used to allow or limit the use of leverage in orders +// when supported +type Leverage struct { + CanUseLeverage bool `json:"can-use-leverage"` + MaximumOrdersWithLeverageRatio float64 `json:"maximum-orders-with-leverage-ratio"` + MaximumLeverageRate float64 `json:"maximum-leverage-rate"` +} + +// MinMax are the rules which limit the placement of orders. +type MinMax struct { + MinimumSize float64 `json:"minimum-size"` // will not place an order if under this amount + MaximumSize float64 `json:"maximum-size"` // can only place an order up to this amount + MaximumTotal float64 `json:"maximum-total"` +} + +// CurrencySettings stores pair based variables +// It contains rules about the specific currency pair +// you wish to trade with +// Backtester will load the data of the currencies specified here +type CurrencySettings struct { + ExchangeName string `json:"exchange-name"` + Asset string `json:"asset"` + Base string `json:"base"` + Quote string `json:"quote"` + + InitialFunds float64 `json:"initial-funds"` + + Leverage Leverage `json:"leverage"` + BuySide MinMax `json:"buy-side"` + SellSide MinMax `json:"sell-side"` + + MinimumSlippagePercent float64 `json:"min-slippage-percent"` + MaximumSlippagePercent float64 `json:"max-slippage-percent"` + + MakerFee float64 `json:"maker-fee-override"` + TakerFee float64 `json:"taker-fee-override"` + + MaximumHoldingsRatio float64 `json:"maximum-holdings-ratio"` +} + +// APIData defines all fields to configure API based data +type APIData struct { + StartDate time.Time `json:"start-date"` + EndDate time.Time `json:"end-date"` + InclusiveEndDate bool `json:"inclusive-end-date"` +} + +// CSVData defines all fields to configure CSV based data +type CSVData struct { + FullPath string `json:"full-path"` +} + +// DatabaseData defines all fields to configure database based data +type DatabaseData struct { + StartDate time.Time `json:"start-date"` + EndDate time.Time `json:"end-date"` + ConfigOverride *database.Config `json:"config-override"` + InclusiveEndDate bool `json:"inclusive-end-date"` +} + +// LiveData defines all fields to configure live data +type LiveData struct { + APIKeyOverride string `json:"api-key-override"` + APISecretOverride string `json:"api-secret-override"` + APIClientIDOverride string `json:"api-client-id-override"` + API2FAOverride string `json:"api-2fa-override"` + RealOrders bool `json:"fake-orders"` +} diff --git a/backtester/config/configbuilder/README.md b/backtester/config/configbuilder/README.md new file mode 100644 index 00000000..2ac7709e --- /dev/null +++ b/backtester/config/configbuilder/README.md @@ -0,0 +1,53 @@ +# GoCryptoTrader Backtester: Configbuilder package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/config/configbuilder) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This configbuilder package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Configbuilder package overview + +### What does the config builder do? +The config builder runs you through the process of creating a strategy config (`.strat`) file. Configs can also be generated via test code under `config_test.go`. +Once the config is created, when running the backtester, you can reference it via `go run . -configPath=(path-to-strat-file)` + +### How do I run it? +`go run .` + +### Anything else? +The config builder will ask you all the necessary questions required to create a config file. If there is anything confusing, feel free to ask a question in our Slack group or open an issue! + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/config/configbuilder/main.go b/backtester/config/configbuilder/main.go new file mode 100644 index 00000000..1ee51006 --- /dev/null +++ b/backtester/config/configbuilder/main.go @@ -0,0 +1,652 @@ +package main + +import ( + "bufio" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + "strconv" + "strings" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies" + gctcommon "github.com/thrasher-corp/gocryptotrader/common" + gctconfig "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/database" + dbPSQL "github.com/thrasher-corp/gocryptotrader/database/drivers/postgres" + dbsqlite3 "github.com/thrasher-corp/gocryptotrader/database/drivers/sqlite3" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +const ( + yes = "yes" + y = "y" +) + +var dataOptions = []string{ + "API", + "CSV", + "Database", + "Live", +} + +func main() { + fmt.Print(common.ASCIILogo) + fmt.Println("Welcome to the config generator!") + reader := bufio.NewReader(os.Stdin) + cfg := config.Config{ + StrategySettings: config.StrategySettings{ + Name: "", + SimultaneousSignalProcessing: false, + CustomSettings: nil, + }, + CurrencySettings: []config.CurrencySettings{}, + DataSettings: config.DataSettings{ + Interval: 0, + DataType: "", + APIData: nil, + DatabaseData: nil, + LiveData: nil, + CSVData: nil, + }, + PortfolioSettings: config.PortfolioSettings{ + Leverage: config.Leverage{}, + BuySide: config.MinMax{}, + SellSide: config.MinMax{}, + }, + StatisticSettings: config.StatisticSettings{}, + GoCryptoTraderConfigPath: "", + } + fmt.Println("-----Strategy Settings-----") + var err error + var strats []strategies.Handler + firstRun := true + for err != nil || firstRun { + firstRun = false + strats, err = parseStrategySettings(&cfg, reader) + if err != nil { + log.Println(err) + } + } + + fmt.Println("-----Exchange Settings-----") + firstRun = true + for err != nil || firstRun { + firstRun = false + err = parseExchangeSettings(reader, &cfg, strats) + if err != nil { + log.Println(err) + } + } + + fmt.Println("-----Portfolio Settings-----") + firstRun = true + for err != nil || firstRun { + firstRun = false + err = parsePortfolioSettings(reader, &cfg) + if err != nil { + log.Println(err) + } + } + + fmt.Println("-----Data Settings-----") + firstRun = true + for err != nil || firstRun { + firstRun = false + err = parseDataSettings(&cfg, reader) + if err != nil { + log.Println(err) + } + } + + fmt.Println("-----Statistics Settings-----") + firstRun = true + for err != nil || firstRun { + firstRun = false + err = parseStatisticsSettings(&cfg, reader) + if err != nil { + log.Println(err) + } + } + + fmt.Println("-----GoCryptoTrader config Settings-----") + firstRun = true + for err != nil || firstRun { + firstRun = false + fmt.Printf("Enter the path to the GoCryptoTrader config you wish to use. Leave blank to use \"%v\"\n", gctconfig.DefaultFilePath()) + path := quickParse(reader) + if path != "" { + cfg.GoCryptoTraderConfigPath = path + } else { + cfg.GoCryptoTraderConfigPath = gctconfig.DefaultFilePath() + } + _, err = os.Stat(cfg.GoCryptoTraderConfigPath) + if err != nil { + log.Println(err) + } + } + + var resp []byte + resp, err = json.MarshalIndent(cfg, "", " ") + if err != nil { + log.Fatal(err) + } + + fmt.Println("Write strategy config to file? If no, the output will be on screen y/n") + yn := quickParse(reader) + if yn == y || yn == yes { + var wd string + wd, err = os.Getwd() + if err != nil { + log.Fatal(err) + } + fn := cfg.StrategySettings.Name + if cfg.Nickname != "" { + fn += "-" + cfg.Nickname + } + fn += ".strat" // nolint:misspell // its shorthand for strategy + wd = filepath.Join(wd, fn) + fmt.Printf("Enter output file. If blank, will output to \"%v\"\n", wd) + path := quickParse(reader) + if path == "" { + path = wd + } + err = ioutil.WriteFile(path, resp, 0770) + if err != nil { + log.Fatal(err) + } + } else { + log.Print(string(resp)) + } + log.Println("Config creation complete!") +} + +func parseStatisticsSettings(cfg *config.Config, reader *bufio.Reader) error { + fmt.Println("Enter the risk free rate. eg 0.03") + var err error + cfg.StatisticSettings.RiskFreeRate, err = strconv.ParseFloat(quickParse(reader), 64) + return err +} + +func parseDataSettings(cfg *config.Config, reader *bufio.Reader) error { + var err error + fmt.Println("Will you be using \"candle\" or \"trade\" data?") + cfg.DataSettings.DataType = quickParse(reader) + if cfg.DataSettings.DataType == common.TradeStr { + fmt.Println("Trade data will be converted into candles") + } + fmt.Println("What candle time interval will you use?") + cfg.DataSettings.Interval, err = parseKlineInterval(reader) + if err != nil { + return err + } + + fmt.Println("Where will this data be sourced?") + var choice string + choice, err = parseDataChoice(reader, len(cfg.CurrencySettings) > 1) + if err != nil { + return err + } + switch choice { + case "API": + err = parseAPI(reader, cfg) + case "Database": + err = parseDatabase(reader, cfg) + case "CSV": + parseCSV(reader, cfg) + case "Live": + parseLive(reader, cfg) + } + return err +} + +func parsePortfolioSettings(reader *bufio.Reader, cfg *config.Config) error { + var err error + fmt.Println("Will there be global portfolio buy-side limits? y/n") + yn := quickParse(reader) + if yn == y || yn == yes { + cfg.PortfolioSettings.BuySide, err = minMaxParse("buy", reader) + if err != nil { + return err + } + } + fmt.Println("Will there be global portfolio sell-side limits? y/n") + yn = quickParse(reader) + if yn == y || yn == yes { + cfg.PortfolioSettings.SellSide, err = minMaxParse("sell", reader) + if err != nil { + return err + } + } + return nil +} + +func parseExchangeSettings(reader *bufio.Reader, cfg *config.Config, strats []strategies.Handler) error { + var err error + addCurrency := y + for strings.Contains(addCurrency, y) { + var currencySetting *config.CurrencySettings + currencySetting, err = addCurrencySetting(reader) + if err != nil { + return err + } + + cfg.CurrencySettings = append(cfg.CurrencySettings, *currencySetting) + fmt.Println("Add another exchange currency setting? y/n") + addCurrency = quickParse(reader) + } + + if len(cfg.CurrencySettings) > 1 { + for i := range strats { + if strats[i].Name() == cfg.StrategySettings.Name && + strats[i].SupportsSimultaneousProcessing() { + fmt.Println("Will this strategy use simultaneous processing? y/n") + yn := quickParse(reader) + if yn == y || yn == yes { + cfg.StrategySettings.SimultaneousSignalProcessing = true + } + break + } + } + } + return nil +} + +func parseStrategySettings(cfg *config.Config, reader *bufio.Reader) ([]strategies.Handler, error) { + fmt.Println("Firstly, please select which strategy you wish to use") + strats := strategies.GetStrategies() + var strategiesToUse []string + for i := range strats { + fmt.Printf("%v. %s\n", i+1, strats[i].Name()) + strategiesToUse = append(strategiesToUse, strats[i].Name()) + } + var err error + cfg.StrategySettings.Name, err = parseStratName(quickParse(reader), strategiesToUse) + if err != nil { + return nil, err + } + + fmt.Println("What is the goal of your strategy?") + cfg.Goal = quickParse(reader) + fmt.Println("Enter a nickname, it can help distinguish between different configs using the same strategy") + cfg.Nickname = quickParse(reader) + fmt.Println("Does this strategy have custom settings? y/n") + customSettings := quickParse(reader) + if strings.Contains(customSettings, y) { + cfg.StrategySettings.CustomSettings = customSettingsLoop(reader) + } + return strats, nil +} + +func parseAPI(reader *bufio.Reader, cfg *config.Config) error { + cfg.DataSettings.APIData = &config.APIData{} + var startDate, endDate, inclusive string + var err error + defaultStart := time.Now().Add(-time.Hour * 24 * 365) + defaultEnd := time.Now() + fmt.Printf("What is the start date? Leave blank for \"%v\"\n", defaultStart.Format(gctcommon.SimpleTimeFormat)) + startDate = quickParse(reader) + if startDate != "" { + cfg.DataSettings.APIData.StartDate, err = time.Parse(startDate, gctcommon.SimpleTimeFormat) + if err != nil { + return err + } + } else { + cfg.DataSettings.APIData.StartDate = defaultStart + } + + fmt.Printf("What is the end date? Leave blank for \"%v\"\n", defaultStart.Format(gctcommon.SimpleTimeFormat)) + endDate = quickParse(reader) + if endDate != "" { + cfg.DataSettings.APIData.EndDate, err = time.Parse(endDate, gctcommon.SimpleTimeFormat) + if err != nil { + return err + } + } else { + cfg.DataSettings.APIData.EndDate = defaultEnd + } + fmt.Println("Is the end date inclusive? y/n") + inclusive = quickParse(reader) + cfg.DataSettings.APIData.InclusiveEndDate = inclusive == y || inclusive == yes + + return nil +} + +func parseCSV(reader *bufio.Reader, cfg *config.Config) { + cfg.DataSettings.CSVData = &config.CSVData{} + fmt.Println("What is path of the CSV file to read?") + cfg.DataSettings.CSVData.FullPath = quickParse(reader) +} + +func parseDatabase(reader *bufio.Reader, cfg *config.Config) error { + cfg.DataSettings.DatabaseData = &config.DatabaseData{} + var input string + var err error + defaultStart := time.Now().Add(-time.Hour * 24 * 365) + defaultEnd := time.Now() + fmt.Printf("What is the start date? Leave blank for \"%v\"\n", defaultStart.Format(gctcommon.SimpleTimeFormat)) + startDate := quickParse(reader) + if startDate != "" { + cfg.DataSettings.DatabaseData.StartDate, err = time.Parse(startDate, gctcommon.SimpleTimeFormat) + if err != nil { + return err + } + } else { + cfg.DataSettings.DatabaseData.StartDate = defaultStart + } + + fmt.Printf("What is the end date? Leave blank for \"%v\"\n", defaultStart.Format(gctcommon.SimpleTimeFormat)) + endDate := quickParse(reader) + if endDate != "" { + cfg.DataSettings.DatabaseData.EndDate, err = time.Parse(endDate, gctcommon.SimpleTimeFormat) + if err != nil { + return err + } + } else { + cfg.DataSettings.DatabaseData.EndDate = defaultEnd + } + fmt.Println("Is the end date inclusive? y/n") + input = quickParse(reader) + cfg.DataSettings.DatabaseData.InclusiveEndDate = input == y || input == yes + + fmt.Println("Do you wish to override GoCryptoTrader's database config? y/n") + input = quickParse(reader) + if input == y || input == yes { + cfg.DataSettings.DatabaseData.ConfigOverride = &database.Config{ + Enabled: true, + } + fmt.Println("Do you want database verbose output? y/n") + input = quickParse(reader) + cfg.DataSettings.DatabaseData.ConfigOverride.Verbose = input == y || input == yes + + fmt.Printf("What database driver to use? %v %v or %v\n", database.DBPostgreSQL, database.DBSQLite, database.DBSQLite3) + cfg.DataSettings.DatabaseData.ConfigOverride.Driver = quickParse(reader) + + fmt.Println("What is the database host?") + cfg.DataSettings.DatabaseData.ConfigOverride.Host = quickParse(reader) + + fmt.Println("What is the database username?") + cfg.DataSettings.DatabaseData.ConfigOverride.Username = quickParse(reader) + + fmt.Println("What is the database password? eg 1234") + cfg.DataSettings.DatabaseData.ConfigOverride.Password = quickParse(reader) + + fmt.Println("What is the database? eg database.db") + cfg.DataSettings.DatabaseData.ConfigOverride.Database = quickParse(reader) + + if cfg.DataSettings.DatabaseData.ConfigOverride.Driver == database.DBPostgreSQL { + fmt.Println("What is the database SSLMode? eg disable") + cfg.DataSettings.DatabaseData.ConfigOverride.SSLMode = quickParse(reader) + } + fmt.Println("What is the database Port? eg 1337") + input = quickParse(reader) + var port float64 + if input != "" { + port, err = strconv.ParseFloat(input, 64) + if err != nil { + return err + } + } + cfg.DataSettings.DatabaseData.ConfigOverride.Port = uint16(port) + database.DB.Config = cfg.DataSettings.DatabaseData.ConfigOverride + if cfg.DataSettings.DatabaseData.ConfigOverride.Driver == database.DBPostgreSQL { + _, err = dbPSQL.Connect() + if err != nil { + return fmt.Errorf("database failed to connect: %v", err) + } + } else if cfg.DataSettings.DatabaseData.ConfigOverride.Driver == database.DBSQLite || + cfg.DataSettings.DatabaseData.ConfigOverride.Driver == database.DBSQLite3 { + _, err = dbsqlite3.Connect() + if err != nil { + return fmt.Errorf("database failed to connect: %v", err) + } + } + } + + return nil +} + +func parseLive(reader *bufio.Reader, cfg *config.Config) { + cfg.DataSettings.LiveData = &config.LiveData{} + fmt.Println("Do you wish to use live trading? It's highly recommended that you do not. y/n") + input := quickParse(reader) + cfg.DataSettings.LiveData.RealOrders = input == y || input == yes + if cfg.DataSettings.LiveData.RealOrders { + fmt.Printf("Do you want to override GoCryptoTrader's API credentials for %s? y/n\n", cfg.CurrencySettings[0].ExchangeName) + input = quickParse(reader) + if input == y || input == yes { + fmt.Println("What is the API key?") + cfg.DataSettings.DatabaseData.ConfigOverride.Database = quickParse(reader) + fmt.Println("What is the API secret?") + cfg.DataSettings.DatabaseData.ConfigOverride.Database = quickParse(reader) + fmt.Println("What is the Client ID?") + cfg.DataSettings.DatabaseData.ConfigOverride.Database = quickParse(reader) + fmt.Println("What is the 2FA seed?") + cfg.DataSettings.DatabaseData.ConfigOverride.Database = quickParse(reader) + } + } +} + +func parseDataChoice(reader *bufio.Reader, multiCurrency bool) (string, error) { + if multiCurrency { + // live trading does not support multiple currencies + dataOptions = dataOptions[:3] + } + for i := range dataOptions { + fmt.Printf("%v. %s\n", i+1, dataOptions[i]) + } + response := quickParse(reader) + num, err := strconv.ParseFloat(response, 64) + if err == nil { + intNum := int(num) + if intNum > len(dataOptions) || intNum <= 0 { + return "", errors.New("unknown option") + } + return dataOptions[intNum-1], nil + } + for i := range dataOptions { + if strings.EqualFold(response, dataOptions[i]) { + return dataOptions[i], nil + } + } + return "", errors.New("unrecognised data option") +} + +func parseKlineInterval(reader *bufio.Reader) (time.Duration, error) { + allCandles := gctkline.SupportedIntervals + for i := range allCandles { + fmt.Printf("%v. %s\n", i+1, allCandles[i].Word()) + } + response := quickParse(reader) + num, err := strconv.ParseFloat(response, 64) + if err == nil { + intNum := int(num) + if intNum > len(allCandles) || intNum <= 0 { + return 0, errors.New("unknown option") + } + return allCandles[intNum-1].Duration(), nil + } + for i := range allCandles { + if strings.EqualFold(response, allCandles[i].Word()) { + return allCandles[i].Duration(), nil + } + } + return 0, errors.New("unrecognised interval") +} + +func parseStratName(name string, strategiesToUse []string) (string, error) { + num, err := strconv.ParseFloat(name, 64) + if err == nil { + intNum := int(num) + if intNum > len(strategiesToUse) || intNum <= 0 { + return "", errors.New("unknown option") + } + return strategiesToUse[intNum-1], nil + } + for i := range strategiesToUse { + if strings.EqualFold(name, strategiesToUse[i]) { + return strategiesToUse[i], nil + } + } + return "", errors.New("unrecognised strategy") +} + +func customSettingsLoop(reader *bufio.Reader) map[string]interface{} { + resp := make(map[string]interface{}) + customSettingField := "loopTime!" + for customSettingField != "" { + fmt.Println("Enter a custom setting name. Enter nothing to stop") + customSettingField = quickParse(reader) + if customSettingField != "" { + fmt.Println("Enter a custom setting value") + resp[customSettingField] = quickParse(reader) + } + } + return resp +} + +func addCurrencySetting(reader *bufio.Reader) (*config.CurrencySettings, error) { + setting := config.CurrencySettings{ + BuySide: config.MinMax{}, + SellSide: config.MinMax{}, + } + fmt.Println("Enter the exchange name. eg Binance") + setting.ExchangeName = quickParse(reader) + + fmt.Println("Please select an asset") + supported := asset.Supported() + for i := range supported { + fmt.Printf("%v. %s\n", i+1, supported[i]) + } + response := quickParse(reader) + num, err := strconv.ParseFloat(response, 64) + if err == nil { + intNum := int(num) + if intNum > len(supported) || intNum <= 0 { + return nil, errors.New("unknown option") + } + setting.Asset = supported[intNum-1].String() + } + for i := range supported { + if strings.EqualFold(response, supported[i].String()) { + setting.Asset = supported[i].String() + } + } + + fmt.Println("Enter the currency base. eg BTC") + setting.Base = quickParse(reader) + + fmt.Println("Enter the currency quote. eg USDT") + setting.Quote = quickParse(reader) + + fmt.Println("Enter the initial funds. eg 10000") + parseNum := quickParse(reader) + if parseNum != "" { + setting.InitialFunds, err = strconv.ParseFloat(parseNum, 64) + if err != nil { + return nil, err + } + } + + fmt.Println("Enter the maker-fee. eg 0.001") + parseNum = quickParse(reader) + if parseNum != "" { + setting.MakerFee, err = strconv.ParseFloat(parseNum, 64) + if err != nil { + return nil, err + } + } + fmt.Println("Enter the taker-fee. eg 0.01") + parseNum = quickParse(reader) + if parseNum != "" { + setting.TakerFee, err = strconv.ParseFloat(parseNum, 64) + if err != nil { + return nil, err + } + } + + fmt.Println("Will there be buy-side limits? y/n") + yn := quickParse(reader) + if yn == y || yn == yes { + setting.BuySide, err = minMaxParse("buy", reader) + if err != nil { + return nil, err + } + } + fmt.Println("Will there be sell-side limits? y/n") + yn = quickParse(reader) + if yn == y || yn == yes { + setting.SellSide, err = minMaxParse("sell", reader) + if err != nil { + return nil, err + } + } + fmt.Println("Do you wish to include slippage? y/n") + yn = quickParse(reader) + if yn == y || yn == yes { + fmt.Println("Slippage is randomly determined between the lower and upper bounds.") + fmt.Println("If the lower bound is 80, then the price can change up to 80% of itself. eg if the price is 100 and the lower bound is 80, then the lowest slipped price is $80") + fmt.Println("If the upper bound is 100, then the price can be unaffected. A minimum of 80 and a maximum of 100 means that the price will randomly be set between those bounds as a way of emulating slippage") + + fmt.Println("What is the lower bounds of slippage? eg 80") + setting.MinimumSlippagePercent, err = strconv.ParseFloat(quickParse(reader), 64) + if err != nil { + return nil, err + } + + fmt.Println("What is the upper bounds of slippage? eg 100") + setting.MaximumSlippagePercent, err = strconv.ParseFloat(quickParse(reader), 64) + if err != nil { + return nil, err + } + } + + return &setting, nil +} + +func minMaxParse(buySell string, reader *bufio.Reader) (config.MinMax, error) { + resp := config.MinMax{} + var err error + fmt.Printf("What is the maximum %s size? eg 1\n", buySell) + parseNum := quickParse(reader) + if parseNum != "" { + resp.MaximumSize, err = strconv.ParseFloat(parseNum, 64) + if err != nil { + return resp, err + } + } + fmt.Printf("What is the minimum %s size? eg 0.1\n", buySell) + parseNum = quickParse(reader) + if parseNum != "" { + resp.MinimumSize, err = strconv.ParseFloat(parseNum, 64) + if err != nil { + return resp, err + } + } + fmt.Printf("What is the maximum spend %s buy? eg 12000\n", buySell) + parseNum = quickParse(reader) + if parseNum != "" { + resp.MaximumTotal, err = strconv.ParseFloat(parseNum, 64) + if err != nil { + return resp, err + } + } + + return resp, nil +} + +func quickParse(reader *bufio.Reader) string { + customSettingField, err := reader.ReadString('\n') + if err != nil { + log.Fatal(err) + } + customSettingField = strings.Replace(customSettingField, "\r", "", -1) + return strings.Replace(customSettingField, "\n", "", -1) +} diff --git a/backtester/config/examples/README.md b/backtester/config/examples/README.md new file mode 100644 index 00000000..a7f4c007 --- /dev/null +++ b/backtester/config/examples/README.md @@ -0,0 +1,52 @@ +# GoCryptoTrader Backtester: Examples package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/config/examples) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This examples package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Examples package overview + +Current Config Examples: + +| Config | Description | +| --- | ------ | +| dollar-cost-average.strat | A simple dollar cost average strategy which makes a purchase on every candle. | +| dollar-cost-average-live.strat | Using the same dollar cost average strategy, but runs the analysis against live candles | +| dollar-cost-average-multi-currency-assessment.strat | This strategy will assess multiple currencies in the one `OnSignals` function, however, it also just simply makes a purchase on every candle | +| dollar-cost-average-multiple-currencies.strat | This runs the same strategy against multiple currencies independently | +| rsi.strat | Runs a strategy using rsi figures to make buy or sell orders based on market figures | + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/config/examples/dca-api-candles-multiple-currencies.strat b/backtester/config/examples/dca-api-candles-multiple-currencies.strat new file mode 100644 index 00000000..53b34d18 --- /dev/null +++ b/backtester/config/examples/dca-api-candles-multiple-currencies.strat @@ -0,0 +1,95 @@ +{ + "nickname": "TestGenerateConfigForDCAAPICandlesMultipleCurrencies", + "goal": "To demonstrate running the DCA strategy using the API against multiple currencies candle data", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": false, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + }, + { + "exchange-name": "binance", + "asset": "spot", + "base": "ETH", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 86400000000000, + "data-type": "candle", + "api-data": { + "start-date": "2020-11-01T00:00:00+11:00", + "end-date": "2020-12-01T00:00:00+11:00", + "inclusive-end-date": false + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/dca-api-candles-simultaneous-processing.strat b/backtester/config/examples/dca-api-candles-simultaneous-processing.strat new file mode 100644 index 00000000..43f548a7 --- /dev/null +++ b/backtester/config/examples/dca-api-candles-simultaneous-processing.strat @@ -0,0 +1,95 @@ +{ + "nickname": "TestGenerateConfigForDCAAPICandlesSimultaneousProcessing", + "goal": "To demonstrate how simultaneous processing can work", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": true, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 1000000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0, + "maximum-size": 0, + "maximum-total": 1000 + }, + "sell-side": { + "minimum-size": 0, + "maximum-size": 0, + "maximum-total": 1000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + }, + { + "exchange-name": "binance", + "asset": "spot", + "base": "ETH", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 86400000000000, + "data-type": "candle", + "api-data": { + "start-date": "2020-11-01T00:00:00+11:00", + "end-date": "2020-12-01T00:00:00+11:00", + "inclusive-end-date": false + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/dca-api-candles.strat b/backtester/config/examples/dca-api-candles.strat new file mode 100644 index 00000000..5b975fe2 --- /dev/null +++ b/backtester/config/examples/dca-api-candles.strat @@ -0,0 +1,68 @@ +{ + "nickname": "TestGenerateConfigForDCAAPICandles", + "goal": "To demonstrate DCA strategy using API candles", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": false, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 86400000000000, + "data-type": "candle", + "api-data": { + "start-date": "2020-11-01T00:00:00+11:00", + "end-date": "2020-12-01T00:00:00+11:00", + "inclusive-end-date": false + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/dca-api-trades.strat b/backtester/config/examples/dca-api-trades.strat new file mode 100644 index 00000000..12e0e977 --- /dev/null +++ b/backtester/config/examples/dca-api-trades.strat @@ -0,0 +1,68 @@ +{ + "nickname": "TestGenerateConfigForDCAAPITrades", + "goal": "To demonstrate running the DCA strategy using API trade data", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": false, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 86400000000000, + "data-type": "trade", + "api-data": { + "start-date": "2020-11-01T00:00:00+11:00", + "end-date": "2020-12-01T00:00:00+11:00", + "inclusive-end-date": false + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/dca-candles-live.strat b/backtester/config/examples/dca-candles-live.strat new file mode 100644 index 00000000..14e4f74e --- /dev/null +++ b/backtester/config/examples/dca-candles-live.strat @@ -0,0 +1,70 @@ +{ + "nickname": "TestGenerateConfigForDCALiveCandles", + "goal": "To demonstrate live trading proof of concept against candle data", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": false, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 3600000000000, + "data-type": "candle", + "live-data": { + "api-key-override": "", + "api-secret-override": "", + "api-client-id-override": "", + "api-2fa-override": "", + "fake-orders": false + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/dca-csv-candles.strat b/backtester/config/examples/dca-csv-candles.strat new file mode 100644 index 00000000..cafe3ec1 --- /dev/null +++ b/backtester/config/examples/dca-csv-candles.strat @@ -0,0 +1,66 @@ +{ + "nickname": "TestGenerateConfigForDCACSVCandles", + "goal": "To demonstrate the DCA strategy using CSV candle data", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": false, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 86400000000000, + "data-type": "candle", + "csv-data": { + "full-path": "..\\testdata\\binance_BTCUSDT_24h_2019_01_01_2020_01_01.csv" + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/dca-csv-trades.strat b/backtester/config/examples/dca-csv-trades.strat new file mode 100644 index 00000000..23cccca1 --- /dev/null +++ b/backtester/config/examples/dca-csv-trades.strat @@ -0,0 +1,66 @@ +{ + "nickname": "TestGenerateConfigForDCACSVTrades", + "goal": "To demonstrate the DCA strategy using CSV trade data", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": false, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 60000000000, + "data-type": "trade", + "csv-data": { + "full-path": "..\\testdata\\binance_BTCUSDT_24h-trades_2020_11_16.csv" + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/dca-database-candles.strat b/backtester/config/examples/dca-database-candles.strat new file mode 100644 index 00000000..befc91f9 --- /dev/null +++ b/backtester/config/examples/dca-database-candles.strat @@ -0,0 +1,81 @@ +{ + "nickname": "TestGenerateConfigForDCADatabaseCandles", + "goal": "To demonstrate the DCA strategy using database candle data", + "strategy-settings": { + "name": "dollarcostaverage", + "use-simultaneous-signal-processing": false, + "custom-settings": null + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 86400000000000, + "data-type": "candle", + "database-data": { + "start-date": "2020-11-01T00:00:00+11:00", + "end-date": "2020-12-01T00:00:00+11:00", + "config-override": { + "enabled": true, + "verbose": false, + "driver": "sqlite", + "connectionDetails": { + "host": "localhost", + "port": 0, + "username": "", + "password": "", + "database": "testsqlite.db", + "sslmode": "" + } + }, + "inclusive-end-date": false + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/config/examples/rsi-api-candles.strat b/backtester/config/examples/rsi-api-candles.strat new file mode 100644 index 00000000..515dc90b --- /dev/null +++ b/backtester/config/examples/rsi-api-candles.strat @@ -0,0 +1,99 @@ +{ + "nickname": "TestGenerateRSICandleAPICustomSettingsStrat", + "goal": "To demonstrate the RSI strategy using API candle data and custom settings", + "strategy-settings": { + "name": "rsi", + "use-simultaneous-signal-processing": false, + "custom-settings": { + "rsi-high": 70, + "rsi-low": 30, + "rsi-period": 14 + } + }, + "currency-settings": [ + { + "exchange-name": "binance", + "asset": "spot", + "base": "BTC", + "quote": "USDT", + "initial-funds": 1000000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + }, + { + "exchange-name": "binance", + "asset": "spot", + "base": "ETH", + "quote": "USDT", + "initial-funds": 100000, + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "min-slippage-percent": 0, + "max-slippage-percent": 0, + "maker-fee-override": 0.001, + "taker-fee-override": 0.002, + "maximum-holdings-ratio": 0 + } + ], + "data-settings": { + "interval": 86400000000000, + "data-type": "candle", + "api-data": { + "start-date": "2020-11-01T00:00:00+11:00", + "end-date": "2020-12-01T00:00:00+11:00", + "inclusive-end-date": false + } + }, + "portfolio-settings": { + "leverage": { + "can-use-leverage": false, + "maximum-orders-with-leverage-ratio": 0, + "maximum-leverage-rate": 0 + }, + "buy-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + }, + "sell-side": { + "minimum-size": 0.1, + "maximum-size": 1, + "maximum-total": 10000 + } + }, + "statistic-settings": { + "risk-free-rate": 0.03 + }, + "gocryptotrader-config-path": "" +} \ No newline at end of file diff --git a/backtester/data/README.md b/backtester/data/README.md new file mode 100644 index 00000000..a3b64098 --- /dev/null +++ b/backtester/data/README.md @@ -0,0 +1,50 @@ +# GoCryptoTrader Backtester: Data package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/data) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This data package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Data package overview + +The data package defines and implements a base version of the `Streamer` interface which is part of the `Handler` interface. These interfaces allow for the translation of data into individual intervals to be accessed and assessed as part of the `backtest` package. +This is a base implementation, the more proper implementation that is used throughout the backtester is under `./kline` + +This can also be used to implement other means to load data for the backtester to process, however kline is currently the only supported method. + + + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/data/data.go b/backtester/data/data.go new file mode 100644 index 00000000..c0e5fa14 --- /dev/null +++ b/backtester/data/data.go @@ -0,0 +1,118 @@ +package data + +import ( + "sort" + "strings" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" +) + +// Setup creates a basic map +func (h *HandlerPerCurrency) Setup() { + if h.data == nil { + h.data = make(map[string]map[asset.Item]map[currency.Pair]Handler) + } +} + +// SetDataForCurrency assigns a data Handler to the data map by exchange, asset and currency +func (h *HandlerPerCurrency) SetDataForCurrency(e string, a asset.Item, p currency.Pair, k Handler) { + if h.data == nil { + h.Setup() + } + e = strings.ToLower(e) + if h.data[e] == nil { + h.data[e] = make(map[asset.Item]map[currency.Pair]Handler) + } + if h.data[e][a] == nil { + h.data[e][a] = make(map[currency.Pair]Handler) + } + h.data[e][a][p] = k +} + +// GetAllData returns all set data in the data map +func (h *HandlerPerCurrency) GetAllData() map[string]map[asset.Item]map[currency.Pair]Handler { + return h.data +} + +// GetDataForCurrency returns the Handler for a specific exchange, asset, currency +func (h *HandlerPerCurrency) GetDataForCurrency(e string, a asset.Item, p currency.Pair) Handler { + return h.data[e][a][p] +} + +// Reset returns the struct to defaults +func (h *HandlerPerCurrency) Reset() { + h.data = nil +} + +// Reset loaded data to blank state +func (b *Base) Reset() { + b.latest = nil + b.offset = 0 + b.stream = nil +} + +// GetStream will return entire data list +func (b *Base) GetStream() []common.DataEventHandler { + return b.stream +} + +// Offset returns the current iteration of candle data the backtester is assessing +func (b *Base) Offset() int { + return b.offset +} + +// SetStream sets the data stream for candle analysis +func (b *Base) SetStream(s []common.DataEventHandler) { + b.stream = s +} + +// AppendStream appends new datas onto the stream, however, will not +// add duplicates. Used for live analysis +func (b *Base) AppendStream(s ...common.DataEventHandler) { + for i := range s { + if s[i] == nil { + continue + } + b.stream = append(b.stream, s[i]) + } +} + +// Next will return the next event in the list and also shift the offset one +func (b *Base) Next() (dh common.DataEventHandler) { + if len(b.stream) <= b.offset { + return nil + } + + ret := b.stream[b.offset] + b.offset++ + b.latest = ret + return ret +} + +// History will return all previous data events that have happened +func (b *Base) History() []common.DataEventHandler { + return b.stream[:b.offset] +} + +// Latest will return latest data event +func (b *Base) Latest() common.DataEventHandler { + return b.latest +} + +// List returns all future data events from the current iteration +// ill-advised to use this in strategies because you don't know the future in real life +func (b *Base) List() []common.DataEventHandler { + return b.stream[b.offset:] +} + +// SortStream sorts the stream by timestamp +func (b *Base) SortStream() { + sort.Slice(b.stream, func(i, j int) bool { + b1 := b.stream[i] + b2 := b.stream[j] + + return b1.GetTime().Before(b2.GetTime()) + }) +} diff --git a/backtester/data/data_test.go b/backtester/data/data_test.go new file mode 100644 index 00000000..a9c32133 --- /dev/null +++ b/backtester/data/data_test.go @@ -0,0 +1,109 @@ +package data + +import ( + "testing" + + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" +) + +const testExchange = "binance" + +func TestBaseDataFunctions(t *testing.T) { + t.Parallel() + var d Base + d.Latest() + d.Next() + o := d.Offset() + if o != 0 { + t.Error("expected 0") + } + d.AppendStream(nil) + d.AppendStream(nil) + d.AppendStream(nil) + + d.Next() + o = d.Offset() + if o != 0 { + t.Error("expected 0") + } + d.List() + d.History() + d.SetStream(nil) + st := d.GetStream() + if st != nil { + t.Error("expected nil") + } + d.Reset() + d.GetStream() + d.SortStream() +} + +func TestSetup(t *testing.T) { + t.Parallel() + d := HandlerPerCurrency{} + d.Setup() + if d.data == nil { + t.Error("expected not nil") + } +} + +func TestSetDataForCurrency(t *testing.T) { + t.Parallel() + d := HandlerPerCurrency{} + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d.SetDataForCurrency(exch, a, p, nil) + if d.data == nil { + t.Error("expected not nil") + } + if d.data[exch][a][p] != nil { + t.Error("expected nil") + } +} + +func TestGetAllData(t *testing.T) { + t.Parallel() + d := HandlerPerCurrency{} + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d.SetDataForCurrency(exch, a, p, nil) + d.SetDataForCurrency(exch, a, currency.NewPair(currency.BTC, currency.DOGE), nil) + result := d.GetAllData() + if len(result) != 1 { + t.Error("expected 1") + } + if len(result[exch][a]) != 2 { + t.Error("expected 2") + } +} + +func TestGetDataForCurrency(t *testing.T) { + t.Parallel() + d := HandlerPerCurrency{} + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d.SetDataForCurrency(exch, a, p, nil) + d.SetDataForCurrency(exch, a, currency.NewPair(currency.BTC, currency.DOGE), nil) + result := d.GetDataForCurrency(exch, a, p) + if result != nil { + t.Error("expected nil") + } +} + +func TestReset(t *testing.T) { + t.Parallel() + d := HandlerPerCurrency{} + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d.SetDataForCurrency(exch, a, p, nil) + d.SetDataForCurrency(exch, a, currency.NewPair(currency.BTC, currency.DOGE), nil) + d.Reset() + if d.data != nil { + t.Error("expected nil") + } +} diff --git a/backtester/data/data_types.go b/backtester/data/data_types.go new file mode 100644 index 00000000..459c3de2 --- /dev/null +++ b/backtester/data/data_types.go @@ -0,0 +1,61 @@ +package data + +import ( + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" +) + +// HandlerPerCurrency stores an event handler per exchange asset pair +type HandlerPerCurrency struct { + data map[string]map[asset.Item]map[currency.Pair]Handler +} + +// Holder interface dictates what a data holder is expected to do +type Holder interface { + Setup() + SetDataForCurrency(string, asset.Item, currency.Pair, Handler) + GetAllData() map[string]map[asset.Item]map[currency.Pair]Handler + GetDataForCurrency(string, asset.Item, currency.Pair) Handler + Reset() +} + +// Base is the base implementation of some interface functions +// where further specific functions are implmented in DataFromKline +type Base struct { + latest common.DataEventHandler + stream []common.DataEventHandler + offset int +} + +// Handler interface for Loading and Streaming data +type Handler interface { + Loader + Streamer + Reset() +} + +// Loader interface for Loading data into backtest supported format +type Loader interface { + Load() error +} + +// Streamer interface handles loading, parsing, distributing BackTest data +type Streamer interface { + Next() common.DataEventHandler + GetStream() []common.DataEventHandler + History() []common.DataEventHandler + Latest() common.DataEventHandler + List() []common.DataEventHandler + Offset() int + + StreamOpen() []float64 + StreamHigh() []float64 + StreamLow() []float64 + StreamClose() []float64 + StreamVol() []float64 + + HasDataAtTime(time.Time) bool +} diff --git a/backtester/data/kline/README.md b/backtester/data/kline/README.md new file mode 100644 index 00000000..77e18837 --- /dev/null +++ b/backtester/data/kline/README.md @@ -0,0 +1,49 @@ +# GoCryptoTrader Backtester: Kline package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/data/kline) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This kline package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Kline package overview + +When loading data for the kline, it can come from two sources: candles or trades. In the config they are represented as `common.CandleStr` or `common.TradeStr` respectively. + +Candle data represents the opening, closing, highest, lowest prices of a given timespan (interval) along with the volume (amount traded) during that same period. You can read more about candles [here](https://www.investopedia.com/terms/c/candlestick.asp). This data is utilised throughout the GoCryptoTrader Backtester in order to make informed strategic decisions. + +Trade data represents the raw trading data on an exchange. Every buy or sell action for the given currency. When trading data is used for the GoCryptoTrader Backtester, it is converted into candle data at the interval you specify. This allows for custom candle intervals not provided by an exchange's API and thus has a greater amount of flexibility in backtesting strategies. + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/data/kline/api/README.md b/backtester/data/kline/api/README.md new file mode 100644 index 00000000..d261a6fc --- /dev/null +++ b/backtester/data/kline/api/README.md @@ -0,0 +1,47 @@ +# GoCryptoTrader Backtester: Api package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/data/kline/api) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This api package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Api package overview + +This package is responsible for the loading of kline data via the API. It can retrieve candle data or trade data which is converted into candle data. +This package uses existing GoCryptoTrader exchange implementations. + +See individual exchange implementations [here](/exchanges) and the interface used [here](/exchanges/interfaces.go) + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/data/kline/api/api.go b/backtester/data/kline/api/api.go new file mode 100644 index 00000000..5b34e45b --- /dev/null +++ b/backtester/data/kline/api/api.go @@ -0,0 +1,52 @@ +package api + +import ( + "fmt" + "strings" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + exchange "github.com/thrasher-corp/gocryptotrader/exchanges" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/trade" +) + +// LoadData retrieves data from a GoCryptoTrader exchange wrapper which calls the exchange's API +func LoadData(dataType int64, startDate, endDate time.Time, interval time.Duration, exch exchange.IBotExchange, fPair currency.Pair, a asset.Item) (*kline.Item, error) { + var candles kline.Item + var err error + switch dataType { + case common.DataCandle: + candles, err = exch.GetHistoricCandlesExtended( + fPair, + a, + startDate, + endDate, + kline.Interval(interval)) + if err != nil { + return nil, fmt.Errorf("could not retrieve candle data for %v %v %v, %v", exch.GetName(), a, fPair, err) + } + case common.DataTrade: + var trades []trade.Data + trades, err = exch.GetHistoricTrades( + fPair, + a, + startDate, + endDate) + if err != nil { + return nil, fmt.Errorf("could not retrieve trade data for %v %v %v, %v", exch.GetName(), a, fPair, err) + } + + candles, err = trade.ConvertTradesToCandles(kline.Interval(interval), trades...) + if err != nil { + return nil, fmt.Errorf("could not convert trade data to candles for %v %v %v, %v", exch.GetName(), a, fPair, err) + } + default: + return nil, fmt.Errorf("could not retrieve data for %v %v %v, invalid data type received", exch.GetName(), a, fPair) + } + candles.Exchange = strings.ToLower(candles.Exchange) + + return &candles, nil +} diff --git a/backtester/data/kline/api/api_test.go b/backtester/data/kline/api/api_test.go new file mode 100644 index 00000000..12e8c163 --- /dev/null +++ b/backtester/data/kline/api/api_test.go @@ -0,0 +1,86 @@ +package api + +import ( + "log" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/engine" + exchange "github.com/thrasher-corp/gocryptotrader/exchanges" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +const testExchange = "binance" + +var ( + bot *engine.Engine + exch exchange.IBotExchange +) + +func TestMain(m *testing.M) { + var err error + bot, err = engine.NewFromSettings(&engine.Settings{ + ConfigFile: filepath.Join("..", "..", "..", "..", "testdata", "configtest.json"), + EnableDryRun: true, + }, nil) + if err != nil { + log.Fatal(err) + } + + err = bot.LoadExchange(testExchange, false, nil) + if err != nil { + log.Fatal(err) + } + exch = bot.GetExchangeByName(testExchange) + if exch == nil { + log.Fatal("expected binance") + } + os.Exit(m.Run()) +} + +func TestLoadCandles(t *testing.T) { + t.Parallel() + tt1 := time.Now().Add(-time.Hour).Round(gctkline.OneHour.Duration()) + tt2 := time.Now().Round(gctkline.OneHour.Duration()) + interval := gctkline.OneHour + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + var data *gctkline.Item + var err error + data, err = LoadData(common.DataCandle, tt1, tt2, interval.Duration(), exch, p, a) + if err != nil { + t.Fatal(err) + } + if len(data.Candles) == 0 { + t.Error("expected candles") + } + + _, err = LoadData(-1, tt1, tt2, interval.Duration(), exch, p, a) + if err != nil && !strings.Contains(err.Error(), "could not retrieve data for Binance spot BTCUSDT, invalid data type received") { + t.Error(err) + } +} + +func TestLoadTrades(t *testing.T) { + t.Parallel() + interval := gctkline.FifteenMin + tt1 := time.Now().Add(-time.Minute * 60).Round(interval.Duration()) + tt2 := time.Now().Round(interval.Duration()) + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + var err error + var data *gctkline.Item + data, err = LoadData(common.DataTrade, tt1, tt2, interval.Duration(), exch, p, a) + if err != nil { + t.Fatal(err) + } + if len(data.Candles) == 0 { + t.Error("expected candles") + } +} diff --git a/backtester/data/kline/csv/README.md b/backtester/data/kline/csv/README.md new file mode 100644 index 00000000..78ef0332 --- /dev/null +++ b/backtester/data/kline/csv/README.md @@ -0,0 +1,69 @@ +# GoCryptoTrader Backtester: Csv package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/data/kline/csv) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This csv package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Csv package overview + +This package is responsible for the loading of kline data via a CSV file. It can retrieve candle data or trade data which is converted into candle data. + +### CSV Format +#### Candle based CSV + +| Field | Example | +| ----- | -------- | +| Timestamp | 1546300800 | +| Volume | 3 | +| Open | 1335 | +| High | 1338 | +| Low | 1336 | +| Close | 1337 | + +Additionally, you can view an example under `./testdata/binance_BTCUSDT_24h_2019_01_01_2020_01_01.csv` + +#### Trade based CSV + +| Field | Example | +| ----- | -------- | +| Timestamp | 1546300800 | +| Price | 1337 | +| Amount | 420.69 | + +Additionally, you can view an example under `./testdata/binance_BTCUSDT_24h-trades_2020_11_16.csv` + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/data/kline/csv/csv.go b/backtester/data/kline/csv/csv.go new file mode 100644 index 00000000..76187c1a --- /dev/null +++ b/backtester/data/kline/csv/csv.go @@ -0,0 +1,160 @@ +package csv + +import ( + "encoding/csv" + "fmt" + "io" + "os" + "strconv" + "strings" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + gctkline "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/trade" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// LoadData is a basic csv reader which converts the found CSV file into a kline item +func LoadData(dataType int64, filepath, exchangeName string, interval time.Duration, fPair currency.Pair, a asset.Item) (*gctkline.DataFromKline, error) { + resp := &gctkline.DataFromKline{} + csvFile, err := os.Open(filepath) + if err != nil { + return nil, err + } + + defer func() { + err = csvFile.Close() + if err != nil { + log.Errorln(log.BackTester, err) + } + }() + + csvData := csv.NewReader(csvFile) + + switch dataType { + case common.DataCandle: + candles := kline.Item{ + Exchange: exchangeName, + Pair: fPair, + Asset: a, + Interval: kline.Interval(interval), + } + + for { + row, errCSV := csvData.Read() + if errCSV != nil { + if errCSV == io.EOF { + break + } + return nil, fmt.Errorf("could not read csv data for %v %v %v, %v", exchangeName, a, fPair, errCSV) + } + + candle := kline.Candle{} + v, errParse := strconv.ParseInt(row[0], 10, 32) + if errParse != nil { + return nil, errParse + } + candle.Time = time.Unix(v, 0).UTC() + if candle.Time.IsZero() { + err = fmt.Errorf("invalid timestamp received on row %v %v", row[0], err) + break + } + + candle.Volume, err = strconv.ParseFloat(row[1], 64) + if err != nil { + err = fmt.Errorf("could not process candle volume %v %v", row[1], err) + break + } + + candle.Open, err = strconv.ParseFloat(row[2], 64) + if err != nil { + err = fmt.Errorf("could not process candle volume %v %v", row[2], err) + break + } + + candle.High, err = strconv.ParseFloat(row[3], 64) + if err != nil { + err = fmt.Errorf("could not process candle high %v %v", row[3], err) + break + } + + candle.Low, err = strconv.ParseFloat(row[4], 64) + if err != nil { + err = fmt.Errorf("could not process candle low %v %v", row[4], err) + break + } + + candle.Close, err = strconv.ParseFloat(row[5], 64) + if err != nil { + err = fmt.Errorf("could not process candle close %v %v", row[5], err) + break + } + + candles.Candles = append(candles.Candles, candle) + } + if err != nil { + return nil, fmt.Errorf("could not read csv candle data for %v %v %v, %v", exchangeName, a, fPair, err) + } + + resp.Item = candles + case common.DataTrade: + var trades []trade.Data + for { + row, errCSV := csvData.Read() + if errCSV != nil { + if errCSV == io.EOF { + break + } + return nil, errCSV + } + + t := trade.Data{} + v, errParse := strconv.ParseInt(row[0], 10, 32) + if errParse != nil { + return nil, errParse + } + t.Timestamp = time.Unix(v, 0).UTC() + if t.Timestamp.IsZero() { + err = fmt.Errorf("invalid timestamp received on row %v", row) + break + } + + t.Price, err = strconv.ParseFloat(row[1], 64) + if err != nil { + err = fmt.Errorf("could not process trade price %v, %v", row[1], err) + break + } + + t.Amount, err = strconv.ParseFloat(row[2], 64) + if err != nil { + err = fmt.Errorf("could not process trade amount %v, %v", row[2], err) + break + } + + t.Side, err = order.StringToOrderSide(row[3]) + if err != nil { + err = fmt.Errorf("could not process trade side %v, %v", row[3], err) + break + } + + trades = append(trades, t) + } + resp.Item, err = trade.ConvertTradesToCandles(kline.Interval(interval), trades...) + if err != nil { + return nil, fmt.Errorf("could not read csv trade data for %v %v %v, %v", exchangeName, a, fPair, err) + } + default: + return nil, fmt.Errorf("could not process csv data for %v %v %v, invalid data type received", exchangeName, a, fPair) + } + resp.Item.Exchange = strings.ToLower(exchangeName) + resp.Item.Pair = fPair + resp.Item.Asset = a + resp.Item.Interval = kline.Interval(interval) + + return resp, nil +} diff --git a/backtester/data/kline/csv/csv_test.go b/backtester/data/kline/csv/csv_test.go new file mode 100644 index 00000000..2d0e56d6 --- /dev/null +++ b/backtester/data/kline/csv/csv_test.go @@ -0,0 +1,62 @@ +package csv + +import ( + "path/filepath" + "strings" + "testing" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +const testExchange = "binance" + +func TestLoadDataCandles(t *testing.T) { + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + _, err := LoadData( + common.DataCandle, + filepath.Join("..", "..", "..", "..", "testdata", "binance_BTCUSDT_24h_2019_01_01_2020_01_01.csv"), + exch, + gctkline.FifteenMin.Duration(), + p, + a) + if err != nil { + t.Error(err) + } +} + +func TestLoadDataTrades(t *testing.T) { + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + _, err := LoadData( + common.DataTrade, + filepath.Join("..", "..", "..", "..", "testdata", "binance_BTCUSDT_24h-trades_2020_11_16.csv"), + exch, + gctkline.FifteenMin.Duration(), + p, + a) + if err != nil { + t.Error(err) + } +} + +func TestLoadDataInvalid(t *testing.T) { + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + _, err := LoadData( + -1, + filepath.Join("..", "..", "..", "..", "testdata", "binance_BTCUSDT_24h-trades_2020_11_16.csv"), + exch, + gctkline.FifteenMin.Duration(), + p, + a) + if err != nil && !strings.Contains(err.Error(), "could not process csv data for binance spot BTCUSDT, invalid data type received") { + t.Error(err) + } +} diff --git a/backtester/data/kline/database/README.md b/backtester/data/kline/database/README.md new file mode 100644 index 00000000..c73fe437 --- /dev/null +++ b/backtester/data/kline/database/README.md @@ -0,0 +1,53 @@ +# GoCryptoTrader Backtester: Database package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/data/kline/database) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This database package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Database package overview + +This package is responsible for the loading of kline data via a user's existing GoCryptoTrader database. It can load existing data from the `candles` and `trades` tables. +For more information on the GoCryptoTrader database, read [this readme](/database/README.md). +Ensure that your database has data and has been seeded with exchanges. For more information on this, please see [this readme](/cmd/dbseed/README.md). + +### Database credentials +#### Defaults +The default database will be loaded from your GoCryptoTrader config. See [this](/database) for database configuration and implementation. + +#### Overriding the GoCryptoTrader config +Database configuration details can be overridden in the `.strat` config file to allow other sources to be used and not rely on existing GoCryptoTrader configuration. See [this readme](/backtester/config/README.md) for details on config customisation + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/data/kline/database/database.go b/backtester/data/kline/database/database.go new file mode 100644 index 00000000..5dd1cdc7 --- /dev/null +++ b/backtester/data/kline/database/database.go @@ -0,0 +1,66 @@ +package database + +import ( + "fmt" + "strings" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/trade" +) + +// LoadData retrieves data from an existing database using GoCryptoTrader's database handling implementation +func LoadData(startDate, endDate time.Time, interval time.Duration, exchangeName string, dataType int64, fPair currency.Pair, a asset.Item) (*kline.DataFromKline, error) { + resp := &kline.DataFromKline{} + switch dataType { + case common.DataCandle: + klineItem, err := getCandleDatabaseData( + startDate, + endDate, + interval, + exchangeName, + fPair, + a) + if err != nil { + return nil, fmt.Errorf("could not retrieve database candle data for %v %v %v, %v", exchangeName, a, fPair, err) + } + resp.Item = klineItem + case common.DataTrade: + trades, err := trade.GetTradesInRange( + exchangeName, + a.String(), + fPair.Base.String(), + fPair.Quote.String(), + startDate, + endDate) + if err != nil { + return nil, err + } + klineItem, err := trade.ConvertTradesToCandles( + gctkline.Interval(interval), + trades...) + if err != nil { + return nil, fmt.Errorf("could not retrieve database trade data for %v %v %v, %v", exchangeName, a, fPair, err) + } + resp.Item = klineItem + default: + return nil, fmt.Errorf("could not retrieve database data for %v %v %v, invalid data type received", exchangeName, a, fPair) + } + resp.Item.Exchange = strings.ToLower(resp.Item.Exchange) + + return resp, nil +} + +func getCandleDatabaseData(startDate, endDate time.Time, interval time.Duration, exchangeName string, fPair currency.Pair, a asset.Item) (gctkline.Item, error) { + return gctkline.LoadFromDatabase( + exchangeName, + fPair, + a, + gctkline.Interval(interval), + startDate, + endDate) +} diff --git a/backtester/data/kline/database/database_test.go b/backtester/data/kline/database/database_test.go new file mode 100644 index 00000000..8dfd414e --- /dev/null +++ b/backtester/data/kline/database/database_test.go @@ -0,0 +1,208 @@ +package database + +import ( + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/database" + "github.com/thrasher-corp/gocryptotrader/database/drivers" + exchangeDB "github.com/thrasher-corp/gocryptotrader/database/repository/exchange" + "github.com/thrasher-corp/gocryptotrader/database/repository/trade" + "github.com/thrasher-corp/gocryptotrader/database/testhelpers" + "github.com/thrasher-corp/gocryptotrader/engine" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const ( + verbose = false + testExchange = "binance" +) + +func TestMain(m *testing.M) { + if verbose { + testhelpers.EnableVerboseTestOutput() + } + var err error + testhelpers.PostgresTestDatabase = testhelpers.GetConnectionDetails() + testhelpers.GetConnectionDetails() + testhelpers.TempDir, err = ioutil.TempDir("", "gct-temp") + if err != nil { + fmt.Printf("failed to create temp file: %v", err) + os.Exit(1) + } + + t := m.Run() + + err = os.RemoveAll(testhelpers.TempDir) + if err != nil { + fmt.Printf("Failed to remove temp db file: %v", err) + } + + os.Exit(t) +} + +func TestLoadDataCandles(t *testing.T) { + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + var err error + bot := &engine.Engine{} + dbConfg := database.Config{ + Enabled: true, + Verbose: false, + Driver: "sqlite", + ConnectionDetails: drivers.ConnectionDetails{ + Host: "localhost", + Database: "test", + }, + } + bot.Config = &config.Config{ + Database: dbConfg, + } + + err = bot.Config.CheckConfig() + if err != nil && verbose { + // this loads the database config to the global database + // the errors are unrelated and likely prone to change for reasons that + // this test does not need to care about + + // so we only log the error if verbose + t.Log(err) + } + database.MigrationDir = filepath.Join("..", "..", "..", "..", "database", "migrations") + testhelpers.MigrationDir = filepath.Join("..", "..", "..", "..", "database", "migrations") + _, err = testhelpers.ConnectToDatabase(&dbConfg) + if err != nil { + t.Error(err) + } + + err = bot.DatabaseManager.Start(bot) + if err != nil { + t.Error(err) + } + + err = exchangeDB.InsertMany([]exchangeDB.Details{{Name: testExchange}}) + if err != nil { + t.Fatal(err) + } + dStart := time.Date(2020, 1, 0, 0, 0, 0, 0, time.UTC) + dInsert := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + dEnd := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC) + + data := &gctkline.Item{ + Exchange: exch, + Pair: p, + Asset: a, + Interval: gctkline.FifteenMin, + Candles: []gctkline.Candle{ + { + Time: dInsert, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }, + } + _, err = gctkline.StoreInDatabase(data, true) + if err != nil { + t.Error(err) + } + + _, err = LoadData(dStart, dEnd, gctkline.FifteenMin.Duration(), exch, common.DataCandle, p, a) + if err != nil { + t.Error(err) + } +} + +func TestLoadDataTrades(t *testing.T) { + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + var err error + bot := &engine.Engine{} + dbConfg := database.Config{ + Enabled: true, + Verbose: false, + Driver: "sqlite", + ConnectionDetails: drivers.ConnectionDetails{ + Host: "localhost", + Database: "test", + }, + } + bot.Config = &config.Config{ + Database: dbConfg, + } + + err = bot.Config.CheckConfig() + if err != nil && verbose { + // this loads the database config to the global database + // the errors are unrelated and likely prone to change for reasons that + // this test does not need to care about + + // so we only log the error if verbose + t.Log(err) + } + database.MigrationDir = filepath.Join("..", "..", "..", "..", "database", "migrations") + testhelpers.MigrationDir = filepath.Join("..", "..", "..", "..", "database", "migrations") + _, err = testhelpers.ConnectToDatabase(&dbConfg) + if err != nil { + t.Error(err) + } + + err = bot.DatabaseManager.Start(bot) + if err != nil { + t.Error(err) + } + + err = exchangeDB.InsertMany([]exchangeDB.Details{{Name: testExchange}}) + if err != nil { + t.Fatal(err) + } + dStart := time.Date(2020, 1, 0, 0, 0, 0, 0, time.UTC) + dInsert := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + dEnd := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC) + err = trade.Insert(trade.Data{ + ID: "123", + TID: "123", + Exchange: exch, + Base: p.Base.String(), + Quote: p.Quote.String(), + AssetType: a.String(), + Price: 1337, + Amount: 1337, + Side: gctorder.Buy.String(), + Timestamp: dInsert, + }) + if err != nil { + t.Error(err) + } + + _, err = LoadData(dStart, dEnd, gctkline.FifteenMin.Duration(), exch, common.DataTrade, p, a) + if err != nil { + t.Error(err) + } +} + +func TestLoadDataInvalid(t *testing.T) { + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + dStart := time.Date(2020, 1, 0, 0, 0, 0, 0, time.UTC) + dEnd := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + _, err := LoadData(dStart, dEnd, gctkline.FifteenMin.Duration(), exch, -1, p, a) + if err != nil && !strings.Contains(err.Error(), "could not retrieve database data for binance spot BTCUSDT, invalid data type received") { + t.Error(err) + } +} diff --git a/backtester/data/kline/kline.go b/backtester/data/kline/kline.go new file mode 100644 index 00000000..992fc52e --- /dev/null +++ b/backtester/data/kline/kline.go @@ -0,0 +1,146 @@ +package kline + +import ( + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// HasDataAtTime verifies checks the underlying range data +// To determine whether there is any candle data present at the time provided +func (d *DataFromKline) HasDataAtTime(t time.Time) bool { + return d.Range.HasDataAtDate(t) +} + +// Load sets the candle data to the stream for processing +func (d *DataFromKline) Load() error { + d.addedTimes = make(map[time.Time]bool) + if len(d.Item.Candles) == 0 { + return errNoCandleData + } + + klineData := make([]common.DataEventHandler, len(d.Item.Candles)) + for i := range d.Item.Candles { + klineData[i] = &kline.Kline{ + Base: event.Base{ + Offset: int64(i + 1), + Exchange: d.Item.Exchange, + Time: d.Item.Candles[i].Time, + Interval: d.Item.Interval, + CurrencyPair: d.Item.Pair, + AssetType: d.Item.Asset, + }, + Open: d.Item.Candles[i].Open, + High: d.Item.Candles[i].High, + Low: d.Item.Candles[i].Low, + Close: d.Item.Candles[i].Close, + Volume: d.Item.Candles[i].Volume, + } + d.addedTimes[d.Item.Candles[i].Time] = true + } + d.SetStream(klineData) + d.SortStream() + return nil +} + +// Append adds a candle item to the data stream and sorts it to ensure it is all in order +func (d *DataFromKline) Append(ki *gctkline.Item) { + if d.addedTimes == nil { + d.addedTimes = make(map[time.Time]bool) + } + var klineData []common.DataEventHandler + var gctCandles []gctkline.Candle + for i := range ki.Candles { + if _, ok := d.addedTimes[ki.Candles[i].Time]; !ok { + gctCandles = append(gctCandles, ki.Candles[i]) + d.addedTimes[ki.Candles[i].Time] = true + } + } + var candleTimes []time.Time + + for i := range gctCandles { + klineData = append(klineData, &kline.Kline{ + Base: event.Base{ + Offset: int64(i + 1), + Exchange: ki.Exchange, + Time: gctCandles[i].Time, + Interval: ki.Interval, + CurrencyPair: ki.Pair, + AssetType: ki.Asset, + }, + Open: gctCandles[i].Open, + High: gctCandles[i].High, + Low: gctCandles[i].Low, + Close: gctCandles[i].Close, + Volume: gctCandles[i].Volume, + }) + candleTimes = append(candleTimes, gctCandles[i].Time) + } + log.Debugf(log.BackTester, "appending %v candle intervals: %v", len(gctCandles), candleTimes) + d.AppendStream(klineData...) + d.SortStream() +} + +// StreamOpen returns all Open prices from the beginning until the current iteration +func (d *DataFromKline) StreamOpen() []float64 { + s := d.GetStream() + o := d.Offset() + + ret := make([]float64, o) + for x := range s[:o] { + ret[x] = s[x].(*kline.Kline).Open + } + return ret +} + +// StreamHigh returns all High prices from the beginning until the current iteration +func (d *DataFromKline) StreamHigh() []float64 { + s := d.GetStream() + o := d.Offset() + + ret := make([]float64, o) + for x := range s[:o] { + ret[x] = s[x].(*kline.Kline).High + } + return ret +} + +// StreamLow returns all Low prices from the beginning until the current iteration +func (d *DataFromKline) StreamLow() []float64 { + s := d.GetStream() + o := d.Offset() + + ret := make([]float64, o) + for x := range s[:o] { + ret[x] = s[x].(*kline.Kline).Low + } + return ret +} + +// StreamClose returns all Close prices from the beginning until the current iteration +func (d *DataFromKline) StreamClose() []float64 { + s := d.GetStream() + o := d.Offset() + + ret := make([]float64, o) + for x := range s[:o] { + ret[x] = s[x].(*kline.Kline).Close + } + return ret +} + +// StreamVol returns all Volume prices from the beginning until the current iteration +func (d *DataFromKline) StreamVol() []float64 { + s := d.GetStream() + o := d.Offset() + + ret := make([]float64, o) + for x := range s[:o] { + ret[x] = s[x].(*kline.Kline).Volume + } + return ret +} diff --git a/backtester/data/kline/kline_test.go b/backtester/data/kline/kline_test.go new file mode 100644 index 00000000..5872bb41 --- /dev/null +++ b/backtester/data/kline/kline_test.go @@ -0,0 +1,288 @@ +package kline + +import ( + "errors" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +const testExchange = "binance" + +func TestLoad(t *testing.T) { + t.Parallel() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + tt := time.Now() + d := DataFromKline{} + err := d.Load() + if !errors.Is(err, errNoCandleData) { + t.Errorf("expected: %v, received %v", errNoCandleData, err) + } + d.Item = gctkline.Item{ + Exchange: exch, + Pair: p, + Asset: a, + Interval: gctkline.FifteenMin, + Candles: []gctkline.Candle{ + { + Time: tt, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }, + } + err = d.Load() + if err != nil { + t.Error(err) + } +} + +func TestHasDataAtTime(t *testing.T) { + t.Parallel() + dStart := time.Date(2020, 1, 0, 0, 0, 0, 0, time.UTC) + dInsert := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + dEnd := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC) + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := DataFromKline{} + has := d.HasDataAtTime(time.Now()) + if has { + t.Error("expected false") + } + + d.Item = gctkline.Item{ + Exchange: exch, + Pair: p, + Asset: a, + Interval: gctkline.OneDay, + Candles: []gctkline.Candle{ + { + Time: dInsert, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }, + } + err := d.Load() + if err != nil { + t.Error(err) + } + + has = d.HasDataAtTime(dInsert) + if has { + t.Error("expected false") + } + + ranger := gctkline.CalculateCandleDateRanges(dStart, dEnd, gctkline.OneDay, 100000) + d.Range = ranger + _ = d.Range.VerifyResultsHaveData(d.Item.Candles) + has = d.HasDataAtTime(dInsert) + if !has { + t.Error("expected true") + } +} + +func TestAppend(t *testing.T) { + t.Parallel() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := DataFromKline{} + item := gctkline.Item{ + Exchange: exch, + Pair: p, + Asset: a, + Interval: gctkline.OneDay, + Candles: []gctkline.Candle{ + { + Time: time.Now(), + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }, + } + d.Append(&item) +} + +func TestStreamOpen(t *testing.T) { + t.Parallel() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := DataFromKline{} + bad := d.StreamOpen() + if len(bad) > 0 { + t.Error("expected no stream") + } + d.SetStream([]common.DataEventHandler{ + &kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: time.Now(), + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }) + d.Next() + open := d.StreamOpen() + if len(open) == 0 { + t.Error("expected open") + } +} + +func TestStreamVolume(t *testing.T) { + t.Parallel() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := DataFromKline{} + bad := d.StreamVol() + if len(bad) > 0 { + t.Error("expected no stream") + } + d.SetStream([]common.DataEventHandler{ + &kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: time.Now(), + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }) + d.Next() + open := d.StreamVol() + if len(open) == 0 { + t.Error("expected volume") + } +} + +func TestStreamClose(t *testing.T) { + t.Parallel() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := DataFromKline{} + bad := d.StreamClose() + if len(bad) > 0 { + t.Error("expected no stream") + } + d.SetStream([]common.DataEventHandler{ + &kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: time.Now(), + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }) + d.Next() + open := d.StreamClose() + if len(open) == 0 { + t.Error("expected close") + } +} + +func TestStreamHigh(t *testing.T) { + t.Parallel() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := DataFromKline{} + bad := d.StreamHigh() + if len(bad) > 0 { + t.Error("expected no stream") + } + d.SetStream([]common.DataEventHandler{ + &kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: time.Now(), + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }) + d.Next() + open := d.StreamHigh() + if len(open) == 0 { + t.Error("expected high") + } +} + +func TestStreamLow(t *testing.T) { + t.Parallel() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := DataFromKline{} + bad := d.StreamLow() + if len(bad) > 0 { + t.Error("expected no stream") + } + d.SetStream([]common.DataEventHandler{ + &kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: time.Now(), + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }) + d.Next() + open := d.StreamLow() + if len(open) == 0 { + t.Error("expected low") + } +} diff --git a/backtester/data/kline/kline_types.go b/backtester/data/kline/kline_types.go new file mode 100644 index 00000000..890ec670 --- /dev/null +++ b/backtester/data/kline/kline_types.go @@ -0,0 +1,21 @@ +package kline + +import ( + "errors" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/data" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +var errNoCandleData = errors.New("no candle data provided") + +// DataFromKline is a struct which implements the data.Streamer interface +// It holds candle data for a specified range with helper functions +type DataFromKline struct { + Item gctkline.Item + data.Base + Range gctkline.IntervalRangeHolder + + addedTimes map[time.Time]bool +} diff --git a/backtester/data/kline/live/README.md b/backtester/data/kline/live/README.md new file mode 100644 index 00000000..ebe3452f --- /dev/null +++ b/backtester/data/kline/live/README.md @@ -0,0 +1,47 @@ +# GoCryptoTrader Backtester: Live package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/data/kline/live) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This live package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Live package overview + +This package will retrieve data for the backtester via continuous requests to live endpoints + +## Important notice +Live trading is not fully implemented and you should never consider setting `RealOrders` to `true` in a config. *Past performance is no guarantee of future results* + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/data/kline/live/live.go b/backtester/data/kline/live/live.go new file mode 100644 index 00000000..9d4ea4cc --- /dev/null +++ b/backtester/data/kline/live/live.go @@ -0,0 +1,65 @@ +package live + +import ( + "fmt" + "strings" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + exchange "github.com/thrasher-corp/gocryptotrader/exchanges" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/trade" +) + +// LoadData retrieves data from a GoCryptoTrader exchange wrapper which calls the exchange's API for the latest interval +func LoadData(exch exchange.IBotExchange, dataType int64, interval time.Duration, fPair currency.Pair, a asset.Item) (*kline.Item, error) { + var candles kline.Item + var err error + switch dataType { + case common.DataCandle: + candles, err = exch.GetHistoricCandles( + fPair, + a, + time.Now().Add(-interval), // multiplied by 2 to ensure the latest candle is always included + time.Now(), + kline.Interval(interval)) + if err != nil { + return nil, fmt.Errorf("could not retrieve live candle data for %v %v %v, %v", exch.GetName(), a, fPair, err) + } + case common.DataTrade: + var trades []trade.Data + trades, err = exch.GetRecentTrades( + fPair, + a) + if err != nil { + return nil, err + } + + candles, err = trade.ConvertTradesToCandles(kline.Interval(interval), trades...) + if err != nil { + return nil, err + } + base := exch.GetBase() + if len(candles.Candles) <= 1 && base.GetSupportedFeatures().RESTCapabilities.TradeHistory { + trades, err = exch.GetHistoricTrades( + fPair, + a, + time.Now().Add(-interval), // multiplied by 2 to ensure the latest candle is always included + time.Now()) + if err != nil { + return nil, fmt.Errorf("could not retrieve live trade data for %v %v %v, %v", exch.GetName(), a, fPair, err) + } + + candles, err = trade.ConvertTradesToCandles(kline.Interval(interval), trades...) + if err != nil { + return nil, fmt.Errorf("could not convert live trade data to candles for %v %v %v, %v", exch.GetName(), a, fPair, err) + } + } + default: + return nil, fmt.Errorf("could not retrieve live data for %v %v %v, invalid data type received", exch.GetName(), a, fPair) + } + candles.Exchange = strings.ToLower(exch.GetName()) + return &candles, nil +} diff --git a/backtester/data/kline/live/live_test.go b/backtester/data/kline/live/live_test.go new file mode 100644 index 00000000..7f75d572 --- /dev/null +++ b/backtester/data/kline/live/live_test.go @@ -0,0 +1,82 @@ +package live + +import ( + "path/filepath" + "strings" + "testing" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/engine" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +const testExchange = "binance" + +func TestLoadCandles(t *testing.T) { + t.Parallel() + interval := gctkline.FifteenMin + bot, err := engine.NewFromSettings(&engine.Settings{ + ConfigFile: filepath.Join("..", "..", "..", "..", "testdata", "configtest.json"), + EnableDryRun: true, + }, nil) + if err != nil { + t.Error(err) + } + + err = bot.LoadExchange(testExchange, false, nil) + if err != nil { + t.Fatal(err) + } + exch := bot.GetExchangeByName(testExchange) + if exch == nil { + t.Fatal("expected binance") + } + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + var data *gctkline.Item + data, err = LoadData(exch, common.DataCandle, interval.Duration(), p, a) + if err != nil { + t.Fatal(err) + } + if len(data.Candles) == 0 { + t.Error("expected candles") + } + + _, err = LoadData(exch, -1, interval.Duration(), p, a) + if err != nil && !strings.Contains(err.Error(), "could not retrieve live data for Binance spot BTCUSDT, invalid data type received") { + t.Error(err) + } +} + +func TestLoadTrades(t *testing.T) { + t.Parallel() + interval := gctkline.FifteenMin + bot, err := engine.NewFromSettings(&engine.Settings{ + ConfigFile: filepath.Join("..", "..", "..", "..", "testdata", "configtest.json"), + EnableDryRun: true, + }, nil) + if err != nil { + t.Error(err) + } + + err = bot.LoadExchange(testExchange, false, nil) + if err != nil { + t.Fatal(err) + } + exch := bot.GetExchangeByName(testExchange) + if exch == nil { + t.Fatal("expected binance") + } + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + var data *gctkline.Item + data, err = LoadData(exch, common.DataTrade, interval.Duration(), p, a) + if err != nil { + t.Fatal(err) + } + if len(data.Candles) == 0 { + t.Error("expected candles") + } +} diff --git a/backtester/eventhandlers/README.md b/backtester/eventhandlers/README.md new file mode 100644 index 00000000..0690e9d5 --- /dev/null +++ b/backtester/eventhandlers/README.md @@ -0,0 +1,47 @@ +# GoCryptoTrader Backtester: Eventhandlers package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This eventhandlers package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Eventhandlers overview + +Event handlers are responsible for taking in an event, analysing its contents and outputting another event to be handled. An individual candle is turned into a data event which handled via the strategy event handler. The strategy handler outputs a signal event, which the portfolio eventhandler will size and risk analyse before raising an order event. The event is then sent to the portfolio manager to determine whether there is appropriate funding, adequate risk and proper order sizing before raising an order event. The order event is taken to the exchange handler which will place the order and create a fill event. +Below is an overview of how event handlers are used +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/eventholder/README.md b/backtester/eventhandlers/eventholder/README.md new file mode 100644 index 00000000..db5432cf --- /dev/null +++ b/backtester/eventhandlers/eventholder/README.md @@ -0,0 +1,46 @@ +# GoCryptoTrader Backtester: Eventholder package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/eventholder) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This eventholder package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Eventholder package overview + +The event holder is a simple interface implementation which allows the backtester to iterate over the event queue. +The event holder is based on the `EventHolder` interface and is implemented by `Holder`. +It is used by `backtest.Backtester` and it accepts appending any struct which implements the `common.EventHandler` interface, eg `order.Order` + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/eventholder/eventholder.go b/backtester/eventhandlers/eventholder/eventholder.go new file mode 100644 index 00000000..b903eaf4 --- /dev/null +++ b/backtester/eventhandlers/eventholder/eventholder.go @@ -0,0 +1,27 @@ +package eventholder + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/common" +) + +// Reset returns struct to defaults +func (e *Holder) Reset() { + e.Queue = nil +} + +// AppendEvent adds and event to the queue +func (e *Holder) AppendEvent(i common.EventHandler) { + e.Queue = append(e.Queue, i) +} + +// NextEvent removes the current event and returns the next event in the queue +func (e *Holder) NextEvent() (i common.EventHandler) { + if len(e.Queue) == 0 { + return nil + } + + i = e.Queue[0] + e.Queue = e.Queue[1:] + + return i +} diff --git a/backtester/eventhandlers/eventholder/eventholder_test.go b/backtester/eventhandlers/eventholder/eventholder_test.go new file mode 100644 index 00000000..3ccbe85b --- /dev/null +++ b/backtester/eventhandlers/eventholder/eventholder_test.go @@ -0,0 +1,48 @@ +package eventholder + +import ( + "testing" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" +) + +func TestReset(t *testing.T) { + t.Parallel() + e := Holder{Queue: []common.EventHandler{}} + e.Reset() + if e.Queue != nil { + t.Error("expected nil") + } +} + +func TestAppendEvent(t *testing.T) { + t.Parallel() + e := Holder{Queue: []common.EventHandler{}} + e.AppendEvent(&order.Order{}) + if len(e.Queue) != 1 { + t.Error("expected 1") + } +} + +func TestNextEvent(t *testing.T) { + t.Parallel() + e := Holder{Queue: []common.EventHandler{}} + ev := e.NextEvent() + if ev != nil { + t.Error("expected not ok") + } + + e = Holder{Queue: []common.EventHandler{ + &order.Order{}, + &order.Order{}, + &order.Order{}, + }} + if len(e.Queue) != 3 { + t.Error("expected 3") + } + e.NextEvent() + if len(e.Queue) != 2 { + t.Error("expected 2") + } +} diff --git a/backtester/eventhandlers/eventholder/eventholder_types.go b/backtester/eventhandlers/eventholder/eventholder_types.go new file mode 100644 index 00000000..b6572126 --- /dev/null +++ b/backtester/eventhandlers/eventholder/eventholder_types.go @@ -0,0 +1,17 @@ +package eventholder + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/common" +) + +// Holder contains the event queue for backtester processing +type Holder struct { + Queue []common.EventHandler +} + +// EventHolder interface details what is expected of an event holder to perform +type EventHolder interface { + Reset() + AppendEvent(common.EventHandler) + NextEvent() (e common.EventHandler) +} diff --git a/backtester/eventhandlers/exchange/README.md b/backtester/eventhandlers/exchange/README.md new file mode 100644 index 00000000..1db8f861 --- /dev/null +++ b/backtester/eventhandlers/exchange/README.md @@ -0,0 +1,58 @@ +# GoCryptoTrader Backtester: Exchange package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This exchange package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Exchange package overview + +The exchange eventhandler is responsible for calling the `engine` package's `ordermanager` to place either a fake, or real order on the exchange via API. + +The following steps are taken for the `ExecuteOrder` function: + +- Calculate slippage. If the order is a sell order, it will reduce the price by a random percentage between the two values. If it is a buy order, it will raise the price by a random percentage between the two values + - If `RealOrders` is set to `false`: + - It will estimate the slippage based on what is in the config file under `min-slippage-percent` and `max-slippage-percent`. + - It will be sized within the constraints of the current candles OHLCV values + - It will generate the exchange fee based on what is stored in the config for the exchange asset currency pair + - If `RealOrders` is set to `true`, it will use the latest orderbook data to calculate slippage by simulating the order + - Place the order with the engine order manager + - If `RealOrders` is set to `false` it will submit the order with no calls to the exchange's API, use no API credentials and it will always pass + - If `RealOrders` is set to `true` it will submit the order via the exchange's API and if successful, will be stored in the order manager + - If an order is successfully placed, a snapshot of all existing orders in the run will be captured and store for statistical purposes + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/exchange/exchange.go b/backtester/eventhandlers/exchange/exchange.go new file mode 100644 index 00000000..3302afe3 --- /dev/null +++ b/backtester/eventhandlers/exchange/exchange.go @@ -0,0 +1,269 @@ +package exchange + +import ( + "fmt" + + "github.com/gofrs/uuid" + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange/slippage" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/engine" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" +) + +// Reset returns the exchange to initial settings +func (e *Exchange) Reset() { + *e = Exchange{} +} + +// ExecuteOrder assesses the portfolio manager's order event and if it passes validation +// will send an order to the exchange/fake order manager to be stored and raise a fill event +func (e *Exchange) ExecuteOrder(o order.Event, data data.Handler, bot *engine.Engine) (*fill.Fill, error) { + f := &fill.Fill{ + Base: event.Base{ + Offset: o.GetOffset(), + Exchange: o.GetExchange(), + Time: o.GetTime(), + CurrencyPair: o.Pair(), + AssetType: o.GetAssetType(), + Interval: o.GetInterval(), + Reason: o.GetReason(), + }, + Direction: o.GetDirection(), + Amount: o.GetAmount(), + + ClosePrice: data.Latest().ClosePrice(), + } + + cs, err := e.GetCurrencySettings(o.GetExchange(), o.GetAssetType(), o.Pair()) + if err != nil { + return f, err + } + + f.ExchangeFee = cs.ExchangeFee // defaulting to just using taker fee right now without orderbook + f.Direction = o.GetDirection() + if o.GetDirection() != gctorder.Buy && o.GetDirection() != gctorder.Sell { + return f, nil + } + highStr := data.StreamHigh() + high := highStr[len(highStr)-1] + + lowStr := data.StreamLow() + low := lowStr[len(lowStr)-1] + + volStr := data.StreamVol() + volume := volStr[len(volStr)-1] + var adjustedPrice, amount float64 + if cs.UseRealOrders { + // get current orderbook + var ob *orderbook.Base + ob, err = orderbook.Get(f.Exchange, f.CurrencyPair, f.AssetType) + if err != nil { + return f, err + } + // calculate an estimated slippage rate + adjustedPrice, amount = slippage.CalculateSlippageByOrderbook(ob, o.GetDirection(), o.GetFunds(), f.ExchangeFee) + f.Slippage = ((adjustedPrice - f.ClosePrice) / f.ClosePrice) * 100 + } else { + adjustedPrice, amount, err = e.sizeOfflineOrder(high, low, volume, &cs, f) + if err != nil { + switch f.GetDirection() { + case gctorder.Buy: + f.SetDirection(common.CouldNotBuy) + case gctorder.Sell: + f.SetDirection(common.CouldNotSell) + default: + f.SetDirection(common.DoNothing) + } + f.AppendReason(err.Error()) + return f, err + } + } + reducedAmount := reduceAmountToFitPortfolioLimit(adjustedPrice, amount, o.GetFunds()) + if reducedAmount != amount { + f.AppendReason(fmt.Sprintf("Order size shrunk from %v to %v to remain within portfolio limits", amount, reducedAmount)) + } + + var orderID string + orderID, err = e.placeOrder(adjustedPrice, reducedAmount, cs.UseRealOrders, f, bot) + if err != nil { + return f, err + } + ords, _ := bot.OrderManager.GetOrdersSnapshot("") + for i := range ords { + if ords[i].ID != orderID { + continue + } + ords[i].Date = o.GetTime() + ords[i].LastUpdated = o.GetTime() + ords[i].CloseTime = o.GetTime() + f.Order = &ords[i] + f.PurchasePrice = ords[i].Price + f.Total = (f.PurchasePrice * reducedAmount) + f.ExchangeFee + } + + if f.Order == nil { + return nil, fmt.Errorf("placed order %v not found in order manager", orderID) + } + + return f, nil +} + +func reduceAmountToFitPortfolioLimit(adjustedPrice, amount, sizedPortfolioTotal float64) float64 { + if adjustedPrice*amount > sizedPortfolioTotal { + // adjusted amounts exceeds portfolio manager's allowed funds + // the amount has to be reduced to equal the sizedPortfolioTotal + amount = sizedPortfolioTotal / adjustedPrice + } + return amount +} + +func (e *Exchange) placeOrder(price, amount float64, useRealOrders bool, f *fill.Fill, bot *engine.Engine) (string, error) { + if f == nil { + return "", common.ErrNilEvent + } + u, err := uuid.NewV4() + if err != nil { + return "", err + } + var orderID string + o := &gctorder.Submit{ + Price: price, + Amount: amount, + Fee: f.ExchangeFee, + Exchange: f.Exchange, + ID: u.String(), + Side: f.Direction, + AssetType: f.AssetType, + Date: f.GetTime(), + LastUpdated: f.GetTime(), + Pair: f.Pair(), + Type: gctorder.Market, + } + + if useRealOrders { + resp, err := bot.OrderManager.Submit(o) + if resp != nil { + orderID = resp.OrderID + } + if err != nil { + return orderID, err + } + } else { + submitResponse := gctorder.SubmitResponse{ + IsOrderPlaced: true, + OrderID: u.String(), + Rate: f.Amount, + Fee: f.ExchangeFee, + Cost: price, + FullyMatched: true, + } + resp, err := bot.OrderManager.SubmitFakeOrder(o, submitResponse) + if resp != nil { + orderID = resp.OrderID + } + if err != nil { + return orderID, err + } + } + return orderID, nil +} + +func (e *Exchange) sizeOfflineOrder(high, low, volume float64, cs *Settings, f *fill.Fill) (adjustedPrice, adjustedAmount float64, err error) { + if cs == nil || f == nil { + return 0, 0, common.ErrNilArguments + } + // provide history and estimate volatility + slippageRate := slippage.EstimateSlippagePercentage(cs.MinimumSlippageRate, cs.MaximumSlippageRate) + f.VolumeAdjustedPrice, adjustedAmount = ensureOrderFitsWithinHLV(f.ClosePrice, f.Amount, high, low, volume) + if adjustedAmount != f.Amount { + f.AppendReason(fmt.Sprintf("Order size shrunk from %v to %v to fit candle", f.Amount, adjustedAmount)) + } + + if adjustedAmount <= 0 && f.Amount > 0 { + return 0, 0, fmt.Errorf("amount set to 0, %w", errDataMayBeIncorrect) + } + adjustedPrice = applySlippageToPrice(f.GetDirection(), f.GetVolumeAdjustedPrice(), slippageRate) + + f.Slippage = (slippageRate * 100) - 100 + f.ExchangeFee = calculateExchangeFee(adjustedPrice, adjustedAmount, cs.ExchangeFee) + return adjustedPrice, adjustedAmount, nil +} + +func applySlippageToPrice(direction gctorder.Side, price, slippageRate float64) float64 { + adjustedPrice := price + if direction == gctorder.Buy { + adjustedPrice = price + (price * (1 - slippageRate)) + } else if direction == gctorder.Sell { + adjustedPrice = price * slippageRate + } + return adjustedPrice +} + +// SetExchangeAssetCurrencySettings sets the settings for an exchange, asset, currency +func (e *Exchange) SetExchangeAssetCurrencySettings(exch string, a asset.Item, cp currency.Pair, c *Settings) { + if c.ExchangeName == "" || + c.AssetType == "" || + c.CurrencyPair.IsEmpty() { + return + } + + for i := range e.CurrencySettings { + if e.CurrencySettings[i].CurrencyPair == cp && + e.CurrencySettings[i].AssetType == a && + exch == e.CurrencySettings[i].ExchangeName { + e.CurrencySettings[i] = *c + return + } + } + e.CurrencySettings = append(e.CurrencySettings, *c) +} + +// GetCurrencySettings returns the settings for an exchange, asset currency +func (e *Exchange) GetCurrencySettings(exch string, a asset.Item, cp currency.Pair) (Settings, error) { + for i := range e.CurrencySettings { + if e.CurrencySettings[i].CurrencyPair == cp { + if e.CurrencySettings[i].AssetType == a { + if exch == e.CurrencySettings[i].ExchangeName { + return e.CurrencySettings[i], nil + } + } + } + } + return Settings{}, fmt.Errorf("no currency settings found for %v %v %v", exch, a, cp) +} + +func ensureOrderFitsWithinHLV(slippagePrice, amount, high, low, volume float64) (adjustedPrice, adjustedAmount float64) { + adjustedPrice = slippagePrice + if adjustedPrice < low { + adjustedPrice = low + } + if adjustedPrice > high { + adjustedPrice = high + } + if volume <= 0 { + return adjustedPrice, adjustedAmount + } + currentVolume := amount * adjustedPrice + if currentVolume > volume { + // reduce the volume to not exceed the total volume of the candle + // it is slightly less than the total to still allow for the illusion + // that open high low close values are valid with the remaining volume + // this is very opinionated + currentVolume = volume * 0.99999999 + } + // extract the amount from the adjusted volume + adjustedAmount = currentVolume / adjustedPrice + + return adjustedPrice, adjustedAmount +} + +func calculateExchangeFee(price, amount, fee float64) float64 { + return fee * price * amount +} diff --git a/backtester/eventhandlers/exchange/exchange_test.go b/backtester/eventhandlers/exchange/exchange_test.go new file mode 100644 index 00000000..e32a3b25 --- /dev/null +++ b/backtester/eventhandlers/exchange/exchange_test.go @@ -0,0 +1,294 @@ +package exchange + +import ( + "errors" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/engine" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const testExchange = "binance" + +func TestReset(t *testing.T) { + t.Parallel() + e := Exchange{ + CurrencySettings: []Settings{}, + } + e.Reset() + if e.CurrencySettings != nil { + t.Error("expected nil") + } +} + +func TestSetCurrency(t *testing.T) { + t.Parallel() + e := Exchange{} + e.SetExchangeAssetCurrencySettings("", "", currency.Pair{}, &Settings{}) + if len(e.CurrencySettings) != 0 { + t.Error("expected 0") + } + cs := &Settings{ + ExchangeName: testExchange, + UseRealOrders: false, + InitialFunds: 1337, + CurrencyPair: currency.NewPair(currency.BTC, currency.USDT), + AssetType: asset.Spot, + ExchangeFee: 0, + MakerFee: 0, + TakerFee: 0, + BuySide: config.MinMax{}, + SellSide: config.MinMax{}, + Leverage: config.Leverage{}, + MinimumSlippageRate: 0, + MaximumSlippageRate: 0, + } + e.SetExchangeAssetCurrencySettings(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USDT), cs) + result, err := e.GetCurrencySettings(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USDT)) + if err != nil { + t.Error(err) + } + if result.InitialFunds != 1337 { + t.Errorf("expected 1337, received %v", result.InitialFunds) + } + + e.SetExchangeAssetCurrencySettings(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USDT), cs) + if len(e.CurrencySettings) != 1 { + t.Error("expected 1") + } +} + +func TestEnsureOrderFitsWithinHLV(t *testing.T) { + t.Parallel() + adjustedPrice, adjustedAmount := ensureOrderFitsWithinHLV(123, 1, 100, 99, 100) + if adjustedAmount != 1 { + t.Error("expected 1") + } + if adjustedPrice != 100 { + t.Error("expected 100") + } + + adjustedPrice, adjustedAmount = ensureOrderFitsWithinHLV(123, 1, 100, 99, 80) + if adjustedAmount != 0.7999999919999999 { + t.Errorf("expected %v received %v", 0.7999999919999999, adjustedAmount) + } + if adjustedPrice != 100 { + t.Error("expected 100") + } +} + +func TestCalculateExchangeFee(t *testing.T) { + t.Parallel() + fee := calculateExchangeFee(1, 1, 0.1) + if fee != 0.1 { + t.Error("expected 0.1") + } + fee = calculateExchangeFee(2, 1, 0.005) + if fee != 0.01 { + t.Error("expected 0.01") + } +} + +func TestSizeOrder(t *testing.T) { + t.Parallel() + e := Exchange{} + _, _, err := e.sizeOfflineOrder(0, 0, 0, nil, nil) + if !errors.Is(err, common.ErrNilArguments) { + t.Error(err) + } + cs := &Settings{} + f := &fill.Fill{ + ClosePrice: 1337, + Amount: 1, + } + _, _, err = e.sizeOfflineOrder(0, 0, 0, cs, f) + if !errors.Is(err, errDataMayBeIncorrect) { + t.Errorf("expected: %v, received %v", errDataMayBeIncorrect, err) + } + var p, a float64 + p, a, err = e.sizeOfflineOrder(10, 2, 10, cs, f) + if err != nil { + t.Error(err) + } + if p != 10 { + t.Error("expected 10") + } + if a != 1 { + t.Error("expected 1") + } +} + +func TestPlaceOrder(t *testing.T) { + t.Parallel() + bot, err := engine.NewFromSettings(&engine.Settings{ + ConfigFile: filepath.Join("..", "..", "..", "testdata", "configtest.json"), + EnableDryRun: true, + }, nil) + if err != nil { + t.Fatal(err) + } + err = bot.OrderManager.Start(bot) + if err != nil { + t.Error(err) + } + err = bot.LoadExchange(testExchange, false, nil) + if err != nil { + t.Error(err) + } + e := Exchange{} + _, err = e.placeOrder(1, 1, false, nil, nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + f := &fill.Fill{} + _, err = e.placeOrder(1, 1, false, f, bot) + if err != nil && err.Error() != "order exchange name must be specified" { + t.Error(err) + } + + f.Exchange = testExchange + _, err = e.placeOrder(1, 1, false, f, bot) + if err != nil && err.Error() != "order pair is empty" { + t.Error(err) + } + f.CurrencyPair = currency.NewPair(currency.BTC, currency.USDT) + f.AssetType = asset.Spot + f.Direction = gctorder.Buy + _, err = e.placeOrder(1, 1, false, f, bot) + if err != nil { + t.Error(err) + } + + _, err = e.placeOrder(1, 1, true, f, bot) + if err != nil && !strings.Contains(err.Error(), "unset/default API keys") { + t.Error(err) + } +} + +func TestExecuteOrder(t *testing.T) { + t.Parallel() + p := currency.NewPair(currency.BTC, currency.USDT) + a := asset.Spot + cs := Settings{ + ExchangeName: testExchange, + UseRealOrders: false, + InitialFunds: 1337, + CurrencyPair: p, + AssetType: a, + ExchangeFee: 0.01, + MakerFee: 0.01, + TakerFee: 0.01, + BuySide: config.MinMax{}, + SellSide: config.MinMax{}, + Leverage: config.Leverage{}, + MinimumSlippageRate: 0, + MaximumSlippageRate: 1, + } + e := Exchange{ + CurrencySettings: []Settings{cs}, + } + ev := event.Base{ + Exchange: testExchange, + Time: time.Now(), + Interval: gctkline.FifteenMin, + CurrencyPair: p, + AssetType: a, + } + o := &order.Order{ + Base: ev, + Direction: gctorder.Buy, + Amount: 1, + Funds: 1337, + } + + bot, err := engine.NewFromSettings(&engine.Settings{ + ConfigFile: filepath.Join("..", "..", "..", "testdata", "configtest.json"), + EnableDryRun: true, + }, nil) + if err != nil { + t.Fatal(err) + } + err = bot.OrderManager.Start(bot) + if err != nil { + t.Error(err) + } + err = bot.LoadExchange(testExchange, false, nil) + if err != nil { + t.Error(err) + } + b := bot.GetExchangeByName(testExchange) + _, err = b.FetchOrderbook(p, a) + if err != nil { + t.Fatal(err) + } + d := &kline.DataFromKline{ + Item: gctkline.Item{ + Exchange: "", + Pair: currency.Pair{}, + Asset: "", + Interval: 0, + Candles: []gctkline.Candle{ + { + Close: 1, + High: 1, + Low: 1, + Volume: 1, + }, + }, + }, + } + err = d.Load() + if err != nil { + t.Error(err) + } + d.Next() + _, err = e.ExecuteOrder(o, d, bot) + if err != nil { + t.Error(err) + } + + cs.UseRealOrders = true + o.Direction = gctorder.Sell + e.CurrencySettings = []Settings{cs} + _, err = e.ExecuteOrder(o, d, bot) + if err != nil && !strings.Contains(err.Error(), "unset/default API keys") { + t.Error(err) + } +} + +func TestApplySlippageToPrice(t *testing.T) { + t.Parallel() + resp := applySlippageToPrice(gctorder.Buy, 1, 0.9) + if resp != 1.1 { + t.Errorf("expected 1.1, received %v", resp) + } + resp = applySlippageToPrice(gctorder.Sell, 1, 0.9) + if resp != 0.9 { + t.Errorf("expected 0.9, received %v", resp) + } +} + +func TestReduceAmountToFitPortfolioLimit(t *testing.T) { + t.Parallel() + initialPrice := 1003.37 + initialAmount := 1337 / initialPrice + portfolioAdjustedTotal := initialAmount * initialPrice + adjustedPrice := 1000.0 + amount := 2.0 + finalAmount := reduceAmountToFitPortfolioLimit(adjustedPrice, amount, portfolioAdjustedTotal) + if finalAmount*adjustedPrice != portfolioAdjustedTotal { + t.Errorf("expected value %v to match portfolio total %v", finalAmount*adjustedPrice, portfolioAdjustedTotal) + } +} diff --git a/backtester/eventhandlers/exchange/exchange_types.go b/backtester/eventhandlers/exchange/exchange_types.go new file mode 100644 index 00000000..ed51eb3b --- /dev/null +++ b/backtester/eventhandlers/exchange/exchange_types.go @@ -0,0 +1,54 @@ +package exchange + +import ( + "errors" + + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/engine" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" +) + +var ( + errDataMayBeIncorrect = errors.New("data may be incorrect") + errExchangeUnset = errors.New("exchange unset") +) + +// ExecutionHandler interface dictates what functions are required to submit an order +type ExecutionHandler interface { + SetExchangeAssetCurrencySettings(string, asset.Item, currency.Pair, *Settings) + GetCurrencySettings(string, asset.Item, currency.Pair) (Settings, error) + ExecuteOrder(order.Event, data.Handler, *engine.Engine) (*fill.Fill, error) + Reset() +} + +// Exchange contains all the currency settings +type Exchange struct { + CurrencySettings []Settings +} + +// Settings allow the eventhandler to size an order within the limitations set by the config file +type Settings struct { + ExchangeName string + UseRealOrders bool + + InitialFunds float64 + + CurrencyPair currency.Pair + AssetType asset.Item + + ExchangeFee float64 + MakerFee float64 + TakerFee float64 + + BuySide config.MinMax + SellSide config.MinMax + + Leverage config.Leverage + + MinimumSlippageRate float64 + MaximumSlippageRate float64 +} diff --git a/backtester/eventhandlers/exchange/slippage/README.md b/backtester/eventhandlers/exchange/slippage/README.md new file mode 100644 index 00000000..df99b14d --- /dev/null +++ b/backtester/eventhandlers/exchange/slippage/README.md @@ -0,0 +1,54 @@ +# GoCryptoTrader Backtester: Slippage package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange/slippage) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This slippage package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Slippage package overview + +Slippage refers to the difference between the expected price of a trade and the price at which the trade is executed. Slippage is used here to simulate what would occur if trading was live as no perfect conditions exist for placing orders. +Slippage is calculated in two ways in the GoCryptoTrader Backtester + +### If `RealOrders` is `true` +- The orderbook is frequently requested during live cycle candle retrieval +- When the order is being calculated in the `ExecuteOrder` eventhandler, it will use the orderbook to simulate placing the order and adjust the order price + +### If `RealOrders` is `false` +- The `min-slippage-percent` and `max-slippage-percent` values for the specific exchange, asset and currency pair will be used as bounds to simulate an orderbook using a random number + - If it is a buy order, it will raise the price by a random percentage between the two values + - If the order is a sell order, it will reduce the price by a random percentage between the two values + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/exchange/slippage/slippage.go b/backtester/eventhandlers/exchange/slippage/slippage.go new file mode 100644 index 00000000..738c79bc --- /dev/null +++ b/backtester/eventhandlers/exchange/slippage/slippage.go @@ -0,0 +1,38 @@ +package slippage + +import ( + "math/rand" + + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" +) + +// EstimateSlippagePercentage takes in an int range of numbers +// turns it into a percentage +func EstimateSlippagePercentage(maximumSlippageRate, minimumSlippageRate float64) float64 { + if minimumSlippageRate < 1 || minimumSlippageRate > 100 { + return 1 + } + if maximumSlippageRate < 1 || maximumSlippageRate > 100 { + return 1 + } + + // the language here is confusing. The maximum slippage rate is the lower bounds of the number, + // eg 80 means for every dollar, keep 80% + randSeed := int(minimumSlippageRate) - int(maximumSlippageRate) + if randSeed > 0 { + result := float64(rand.Intn(randSeed)) // nolint:gosec // basic number generation required, no need for crypto/rand + return (result + maximumSlippageRate) / 100 + } + return 1 +} + +// CalculateSlippageByOrderbook will analyse a provided orderbook and return the result of attempting to +// place the order on there +func CalculateSlippageByOrderbook(ob *orderbook.Base, side gctorder.Side, amountOfFunds, feeRate float64) (price, amount float64) { + result := ob.SimulateOrder(amountOfFunds, side == gctorder.Buy) + rate := (result.MinimumPrice - result.MaximumPrice) / result.MaximumPrice + price = result.MinimumPrice * (rate + 1) + amount = result.Amount * (1 - feeRate) + return +} diff --git a/backtester/eventhandlers/exchange/slippage/slippage_test.go b/backtester/eventhandlers/exchange/slippage/slippage_test.go new file mode 100644 index 00000000..60c23532 --- /dev/null +++ b/backtester/eventhandlers/exchange/slippage/slippage_test.go @@ -0,0 +1,35 @@ +package slippage + +import ( + "testing" + + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/bitstamp" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +func TestRandomSlippage(t *testing.T) { + t.Parallel() + resp := EstimateSlippagePercentage(80, 100) + if resp < 0.8 || resp > 1 { + t.Error("expected result > 0.8 and < 100") + } +} + +func TestCalculateSlippageByOrderbook(t *testing.T) { + t.Parallel() + b := bitstamp.Bitstamp{} + b.SetDefaults() + cp := currency.NewPair(currency.BTC, currency.USD) + ob, err := b.FetchOrderbook(cp, asset.Spot) + if err != nil { + t.Fatal(err) + } + amountOfFunds := 1000.0 + feeRate := 0.03 + price, amount := CalculateSlippageByOrderbook(ob, gctorder.Buy, amountOfFunds, feeRate) + if price*amount+(price*amount*feeRate) > amountOfFunds { + t.Error("order size must be less than funds") + } +} diff --git a/backtester/eventhandlers/exchange/slippage/slippage_types.go b/backtester/eventhandlers/exchange/slippage/slippage_types.go new file mode 100644 index 00000000..08b0a5ff --- /dev/null +++ b/backtester/eventhandlers/exchange/slippage/slippage_types.go @@ -0,0 +1,8 @@ +package slippage + +// Default slippage rates. It works on a percentage basis +// 100 means unaffected, 95 would mean 95% +const ( + DefaultMaximumSlippagePercent = 100 + DefaultMinimumSlippagePercent = 100 +) diff --git a/backtester/eventhandlers/portfolio/README.md b/backtester/eventhandlers/portfolio/README.md new file mode 100644 index 00000000..dc06451d --- /dev/null +++ b/backtester/eventhandlers/portfolio/README.md @@ -0,0 +1,68 @@ +# GoCryptoTrader Backtester: Portfolio package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This portfolio package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Portfolio package overview + +The portfolio is one of the most critical packages in the GoCryptoTrader Backtester. It is responsible for making sure that all orders, simulated or otherwise are within all defined risk and sizing rules defined in the config. +The portfolio receives three kinds of events to be processed: `OnSignal`, `OnFill` and `Update` + +The following steps are taken for the `OnSignal` function: +- Retrieve previous iteration's holdings data +- If a buy order signal is received, ensure there are enough funds +- If a sell order signal is received, ensure there are any holdings to sell +- If any other direction, return +- The portfolio manager will then size the order according to the exchange asset currency pair's settings along with the portfolio manager's own sizing rules + - In the event that the order is to large, the sizing package will reduce the order until it fits that limit, inclusive of fees. + - When an order is sized under the limits, an order event cannot be raised an no order will be submitted by the exchange + - The portfolio manager's sizing rules override any CurrencySettings' rules if the sizing is outside the portfolio manager's +- The portfolio manager will then assess the risk of the order, it will compare existing holdings and ensures that if an order is placed, it will not go beyond risk rules as defined in the config +- If the risk is too high, the order signal will be changed to `CouldNotBuy`, `CouldNotSell` or `DoNothing` +- If the order is deemed appropriate, the order event will be returned and appended to the event queue for the exchange event handler to run and place the order + +The following steps are taken for the `OnFill` function: +- Previous holdings are retrieved and amended with new order information. + - The stats for the exchange asset currency pair will be updated to reflect the order and pricing +- The order will be added to the compliance manager for analysis in future events or the statistics package + +The following steps are taken for the `Update` function: +- The `Update` function is called when orders are not placed, this allows for the portfolio manager to still keep track of pricing and holding statistics, while not needing to process any orders + + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/portfolio/compliance/README.md b/backtester/eventhandlers/portfolio/compliance/README.md new file mode 100644 index 00000000..31b67a9b --- /dev/null +++ b/backtester/eventhandlers/portfolio/compliance/README.md @@ -0,0 +1,45 @@ +# GoCryptoTrader Backtester: Compliance package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This compliance package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Compliance package overview + +The compliance manager is used to store all events at each time interval. When debugging the backtester or wanting to audit backtesting results, you can inspect every single action that has occurred during the backtesting run + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/portfolio/compliance/compliance.go b/backtester/eventhandlers/portfolio/compliance/compliance.go new file mode 100644 index 00000000..08e7fec0 --- /dev/null +++ b/backtester/eventhandlers/portfolio/compliance/compliance.go @@ -0,0 +1,51 @@ +package compliance + +import ( + "fmt" + "time" +) + +// AddSnapshot creates a snapshot in time of the orders placed to allow for finer detail tracking +// and to protect against anything modifying order details elsewhere +func (m *Manager) AddSnapshot(orders []SnapshotOrder, t time.Time, offset int64, overwriteExisting bool) error { + if overwriteExisting { + if len(m.Snapshots) == 0 { + return errSnapshotNotFound + } + for i := len(m.Snapshots) - 1; i >= 0; i-- { + if offset == m.Snapshots[i].Offset { + m.Snapshots[i].Orders = orders + return nil + } + } + return fmt.Errorf("%w at %v", errSnapshotNotFound, offset) + } + m.Snapshots = append(m.Snapshots, Snapshot{ + Orders: orders, + Timestamp: t, + Offset: offset, + }) + + return nil +} + +// GetSnapshotAtTime returns the snapshot of orders a t time +func (m *Manager) GetSnapshotAtTime(t time.Time) (Snapshot, error) { + for i := len(m.Snapshots) - 1; i >= 0; i-- { + if t.Equal(m.Snapshots[i].Timestamp) { + return m.Snapshots[i], nil + } + } + return Snapshot{}, fmt.Errorf("%w at %v", errSnapshotNotFound, t) +} + +// GetLatestSnapshot returns the snapshot of t - 1 interval +func (m *Manager) GetLatestSnapshot() Snapshot { + if len(m.Snapshots) == 0 { + return Snapshot{ + Offset: 1, + } + } + + return m.Snapshots[len(m.Snapshots)-1] +} diff --git a/backtester/eventhandlers/portfolio/compliance/compliance_test.go b/backtester/eventhandlers/portfolio/compliance/compliance_test.go new file mode 100644 index 00000000..22e93b4b --- /dev/null +++ b/backtester/eventhandlers/portfolio/compliance/compliance_test.go @@ -0,0 +1,93 @@ +package compliance + +import ( + "errors" + "testing" + "time" +) + +func TestAddSnapshot(t *testing.T) { + t.Parallel() + m := Manager{} + tt := time.Now() + err := m.AddSnapshot([]SnapshotOrder{}, tt, 1, true) + if !errors.Is(err, errSnapshotNotFound) { + t.Errorf("expected: %v, received %v", errSnapshotNotFound, err) + } + + err = m.AddSnapshot([]SnapshotOrder{}, tt, 1, false) + if err != nil { + t.Error(err) + } + + err = m.AddSnapshot([]SnapshotOrder{}, tt, 1, true) + if err != nil { + t.Error(err) + } +} + +func TestGetSnapshotAtTime(t *testing.T) { + t.Parallel() + m := Manager{} + tt := time.Now() + err := m.AddSnapshot([]SnapshotOrder{ + { + ClosePrice: 1337, + }, + }, tt, 1, false) + if err != nil { + t.Error(err) + } + var snappySnap Snapshot + snappySnap, err = m.GetSnapshotAtTime(tt) + if err != nil { + t.Error(err) + } + if len(snappySnap.Orders) == 0 { + t.Fatal("expected an order") + } + if snappySnap.Orders[0].ClosePrice != 1337 { + t.Error("expected 1337") + } + if !snappySnap.Timestamp.Equal(tt) { + t.Errorf("expected %v, received %v", tt, snappySnap.Timestamp) + } + + _, err = m.GetSnapshotAtTime(time.Now().Add(time.Hour)) + if !errors.Is(err, errSnapshotNotFound) { + t.Errorf("expected: %v, received %v", errSnapshotNotFound, err) + } +} + +func TestGetLatestSnapshot(t *testing.T) { + t.Parallel() + m := Manager{} + snappySnap := m.GetLatestSnapshot() + if !snappySnap.Timestamp.IsZero() { + t.Error("expected blank snapshot") + } + tt := time.Now() + err := m.AddSnapshot([]SnapshotOrder{ + { + ClosePrice: 1337, + }, + }, tt, 1, false) + if err != nil { + t.Error(err) + } + err = m.AddSnapshot([]SnapshotOrder{ + { + ClosePrice: 1337, + }, + }, tt.Add(time.Hour), 1, false) + if err != nil { + t.Error(err) + } + snappySnap = m.GetLatestSnapshot() + if snappySnap.Timestamp.Equal(tt) { + t.Errorf("expected %v", tt.Add(time.Hour)) + } + if !snappySnap.Timestamp.Equal(tt.Add(time.Hour)) { + t.Errorf("expected %v", tt.Add(time.Hour)) + } +} diff --git a/backtester/eventhandlers/portfolio/compliance/compliance_types.go b/backtester/eventhandlers/portfolio/compliance/compliance_types.go new file mode 100644 index 00000000..c6721bbc --- /dev/null +++ b/backtester/eventhandlers/portfolio/compliance/compliance_types.go @@ -0,0 +1,36 @@ +package compliance + +import ( + "errors" + "time" + + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +var ( + errSnapshotNotFound = errors.New("snapshot not found") +) + +// Manager holds a snapshot of all orders at each timeperiod, allowing +// study of all changes across time +type Manager struct { + Snapshots []Snapshot +} + +// Snapshot consists of the timestamp the snapshot is from, along with all orders made +// up until that time +type Snapshot struct { + Orders []SnapshotOrder `json:"orders"` + Timestamp time.Time `json:"timestamp"` + Offset int64 `json:"offset"` +} + +// SnapshotOrder adds some additional data that's only relevant for backtesting +// to the order.Detail without adding to order.Detail +type SnapshotOrder struct { + ClosePrice float64 `json:"close-price"` + VolumeAdjustedPrice float64 `json:"volume-adjusted-price"` + SlippageRate float64 `json:"slippage-rate"` + CostBasis float64 `json:"cost-basis"` + *order.Detail `json:"order-detail"` +} diff --git a/backtester/eventhandlers/portfolio/holdings/README.md b/backtester/eventhandlers/portfolio/holdings/README.md new file mode 100644 index 00000000..54df32f9 --- /dev/null +++ b/backtester/eventhandlers/portfolio/holdings/README.md @@ -0,0 +1,46 @@ +# GoCryptoTrader Backtester: Holdings package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This holdings package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Holdings package overview + +Holdings are used to calculate the holdings at any given time for a given exchange, asset, currency pair. If an order is placed, funds are removed from funding and placed under assets. +Every data event will update and calculate holdings value based on the new price. This will allow for statistics to be easily calculated at the end of a backtesting run + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/portfolio/holdings/holdings.go b/backtester/eventhandlers/portfolio/holdings/holdings.go new file mode 100644 index 00000000..f50696b8 --- /dev/null +++ b/backtester/eventhandlers/portfolio/holdings/holdings.go @@ -0,0 +1,92 @@ +package holdings + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// Create takes a fill event and creates a new holding for the exchange, asset, pair +func Create(f fill.Event, initialFunds, riskFreeRate float64) (Holding, error) { + if f == nil { + return Holding{}, common.ErrNilEvent + } + if initialFunds <= 0 { + return Holding{}, ErrInitialFundsZero + } + h := Holding{ + Offset: f.GetOffset(), + Pair: f.Pair(), + Asset: f.GetAssetType(), + Exchange: f.GetExchange(), + Timestamp: f.GetTime(), + InitialFunds: initialFunds, + RemainingFunds: initialFunds, + RiskFreeRate: riskFreeRate, + } + h.update(f) + + return h, nil +} + +// Update calculates holding statistics for the events time +func (h *Holding) Update(f fill.Event) { + h.Timestamp = f.GetTime() + h.Offset = f.GetOffset() + h.update(f) +} + +// UpdateValue calculates the holding's value for a data event's time and price +func (h *Holding) UpdateValue(d common.DataEventHandler) { + h.Timestamp = d.GetTime() + latest := d.ClosePrice() + h.Offset = d.GetOffset() + h.updateValue(latest) +} + +func (h *Holding) update(f fill.Event) { + direction := f.GetDirection() + o := f.GetOrder() + switch direction { + case order.Buy: + h.CommittedFunds += (o.Amount * o.Price) + o.Fee + h.PositionsSize += o.Amount + h.PositionsValue += o.Amount * o.Price + h.RemainingFunds -= (o.Amount * o.Price) + o.Fee + h.TotalFees += o.Fee + h.BoughtAmount += o.Amount + h.BoughtValue += o.Amount * o.Price + case order.Sell: + h.CommittedFunds -= (o.Amount * o.Price) + o.Fee + h.PositionsSize -= o.Amount + h.PositionsValue -= o.Amount * o.Price + h.RemainingFunds += (o.Amount * o.Price) - o.Fee + h.TotalFees += o.Fee + h.SoldAmount += o.Amount + h.SoldValue += o.Amount * o.Price + case common.DoNothing, common.CouldNotSell, common.CouldNotBuy, common.MissingData, "": + } + h.TotalValueLostToVolumeSizing += (f.GetClosePrice() - f.GetVolumeAdjustedPrice()) * f.GetAmount() + h.TotalValueLostToSlippage += (f.GetVolumeAdjustedPrice() - f.GetPurchasePrice()) * f.GetAmount() + h.updateValue(f.GetClosePrice()) +} + +func (h *Holding) updateValue(l float64) { + origPosValue := h.PositionsValue + origBoughtValue := h.BoughtValue + origSoldValue := h.SoldValue + origTotalValue := h.TotalValue + h.PositionsValue = h.PositionsSize * l + h.BoughtValue = h.BoughtAmount * l + h.SoldValue = h.SoldAmount * l + h.TotalValue = h.PositionsValue + h.RemainingFunds + + h.TotalValueDifference = h.TotalValue - origTotalValue + h.BoughtValueDifference = h.BoughtValue - origBoughtValue + h.PositionsValueDifference = h.PositionsValue - origPosValue + h.SoldValueDifference = h.SoldValue - origSoldValue + + if origTotalValue != 0 { + h.ChangeInTotalValuePercent = (h.TotalValue - origTotalValue) / origTotalValue + } +} diff --git a/backtester/eventhandlers/portfolio/holdings/holdings_test.go b/backtester/eventhandlers/portfolio/holdings/holdings_test.go new file mode 100644 index 00000000..adb94928 --- /dev/null +++ b/backtester/eventhandlers/portfolio/holdings/holdings_test.go @@ -0,0 +1,343 @@ +package holdings + +import ( + "errors" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const ( + testExchange = "binance" + riskFreeRate = 0.03 +) + +func TestCreate(t *testing.T) { + t.Parallel() + _, err := Create(nil, -1, riskFreeRate) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", ErrInitialFundsZero, err) + } + + _, err = Create(&fill.Fill{}, -1, riskFreeRate) + if !errors.Is(err, ErrInitialFundsZero) { + t.Errorf("expected: %v, received %v", ErrInitialFundsZero, err) + } + + _, err = Create(nil, 1, riskFreeRate) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + + h, err := Create(&fill.Fill{}, 1, riskFreeRate) + if err != nil { + t.Error(err) + } + if h.InitialFunds != 1 { + t.Errorf("expected 1, received '%v'", h.InitialFunds) + } +} + +func TestUpdate(t *testing.T) { + t.Parallel() + h, err := Create(&fill.Fill{}, 1, riskFreeRate) + if err != nil { + t.Error(err) + } + t1 := h.Timestamp + h.Update(&fill.Fill{ + Base: event.Base{ + Time: time.Now(), + }, + }) + if t1.Equal(h.Timestamp) { + t.Errorf("expected '%v' received '%v'", h.Timestamp, t1) + } +} + +func TestUpdateValue(t *testing.T) { + t.Parallel() + h, err := Create(&fill.Fill{}, 1, riskFreeRate) + if err != nil { + t.Error(err) + } + h.PositionsSize = 1 + h.UpdateValue(&kline.Kline{ + Close: 1337, + }) + if h.PositionsValue != 1337 { + t.Errorf("expected '%v' received '%v'", h.PositionsValue, 1337) + } +} + +func TestUpdateBuyStats(t *testing.T) { + t.Parallel() + h, err := Create(&fill.Fill{}, 1000, riskFreeRate) + if err != nil { + t.Error(err) + } + h.update(&fill.Fill{ + Base: event.Base{ + Exchange: testExchange, + Time: time.Now(), + Interval: gctkline.OneHour, + CurrencyPair: currency.NewPair(currency.BTC, currency.USDT), + AssetType: asset.Spot, + }, + Direction: order.Buy, + Amount: 1, + ClosePrice: 500, + VolumeAdjustedPrice: 500, + PurchasePrice: 500, + ExchangeFee: 0, + Slippage: 0, + Order: &order.Detail{ + Price: 500, + Amount: 1, + Exchange: testExchange, + ID: "1337", + Type: order.Limit, + Side: order.Buy, + Status: order.New, + AssetType: asset.Spot, + Date: time.Now(), + CloseTime: time.Now(), + LastUpdated: time.Now(), + Pair: currency.NewPair(currency.BTC, currency.USDT), + Trades: nil, + Fee: 1, + }, + }) + if err != nil { + t.Error(err) + } + if h.PositionsSize != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.PositionsSize) + } + if h.PositionsValue != 500 { + t.Errorf("expected '%v' received '%v'", 500, h.PositionsValue) + } + if h.InitialFunds != 1000 { + t.Errorf("expected '%v' received '%v'", 1000, h.InitialFunds) + } + if h.RemainingFunds != 499 { + t.Errorf("expected '%v' received '%v'", 499, h.RemainingFunds) + } + if h.TotalValue != 999 { + t.Errorf("expected '%v' received '%v'", 999, h.TotalValue) + } + if h.BoughtAmount != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.BoughtAmount) + } + if h.BoughtValue != 500 { + t.Errorf("expected '%v' received '%v'", 500, h.BoughtValue) + } + if h.SoldAmount != 0 { + t.Errorf("expected '%v' received '%v'", 0, h.SoldAmount) + } + if h.TotalFees != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.TotalFees) + } + + h.update(&fill.Fill{ + Base: event.Base{ + Exchange: testExchange, + Time: time.Now(), + Interval: gctkline.OneHour, + CurrencyPair: currency.NewPair(currency.BTC, currency.USDT), + AssetType: asset.Spot, + }, + Direction: order.Buy, + Amount: 0.5, + ClosePrice: 500, + VolumeAdjustedPrice: 500, + PurchasePrice: 500, + ExchangeFee: 0, + Slippage: 0, + Order: &order.Detail{ + Price: 500, + Amount: 0.5, + Exchange: testExchange, + ID: "1337", + Type: order.Limit, + Side: order.Buy, + Status: order.New, + AssetType: asset.Spot, + Date: time.Now(), + CloseTime: time.Now(), + LastUpdated: time.Now(), + Pair: currency.NewPair(currency.BTC, currency.USDT), + Trades: nil, + Fee: 0.5, + }, + }) + if err != nil { + t.Error(err) + } + if h.PositionsSize != 1.5 { + t.Errorf("expected '%v' received '%v'", 1, h.PositionsSize) + } + if h.PositionsValue != 750 { + t.Errorf("expected '%v' received '%v'", 750, h.PositionsValue) + } + if h.InitialFunds != 1000 { + t.Errorf("expected '%v' received '%v'", 1000, h.InitialFunds) + } + if h.RemainingFunds != 248.5 { + t.Errorf("expected '%v' received '%v'", 248.5, h.RemainingFunds) + } + if h.TotalValue != 998.5 { + t.Errorf("expected '%v' received '%v'", 998.5, h.TotalValue) + } + if h.BoughtAmount != 1.5 { + t.Errorf("expected '%v' received '%v'", 1, h.BoughtAmount) + } + if h.BoughtValue != 750 { + t.Errorf("expected '%v' received '%v'", 750, h.BoughtValue) + } + if h.SoldAmount != 0 { + t.Errorf("expected '%v' received '%v'", 0, h.SoldAmount) + } + if h.TotalFees != 1.5 { + t.Errorf("expected '%v' received '%v'", 1.5, h.TotalFees) + } +} + +func TestUpdateSellStats(t *testing.T) { + t.Parallel() + h, err := Create(&fill.Fill{}, 1000, riskFreeRate) + if err != nil { + t.Error(err) + } + h.update(&fill.Fill{ + Base: event.Base{ + Exchange: testExchange, + Time: time.Now(), + Interval: gctkline.OneHour, + CurrencyPair: currency.NewPair(currency.BTC, currency.USDT), + AssetType: asset.Spot, + }, + Direction: order.Buy, + Amount: 1, + ClosePrice: 500, + VolumeAdjustedPrice: 500, + PurchasePrice: 500, + ExchangeFee: 0, + Slippage: 0, + Order: &order.Detail{ + Price: 500, + Amount: 1, + Exchange: testExchange, + ID: "1337", + Type: order.Limit, + Side: order.Buy, + Status: order.New, + AssetType: asset.Spot, + Date: time.Now(), + CloseTime: time.Now(), + LastUpdated: time.Now(), + Pair: currency.NewPair(currency.BTC, currency.USDT), + Trades: nil, + Fee: 1, + }, + }) + if err != nil { + t.Error(err) + } + if h.PositionsSize != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.PositionsSize) + } + if h.PositionsValue != 500 { + t.Errorf("expected '%v' received '%v'", 500, h.PositionsValue) + } + if h.InitialFunds != 1000 { + t.Errorf("expected '%v' received '%v'", 1000, h.InitialFunds) + } + if h.RemainingFunds != 499 { + t.Errorf("expected '%v' received '%v'", 499, h.RemainingFunds) + } + if h.TotalValue != 999 { + t.Errorf("expected '%v' received '%v'", 999, h.TotalValue) + } + if h.BoughtAmount != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.BoughtAmount) + } + if h.BoughtValue != 500 { + t.Errorf("expected '%v' received '%v'", 500, h.BoughtValue) + } + if h.SoldAmount != 0 { + t.Errorf("expected '%v' received '%v'", 0, h.SoldAmount) + } + if h.TotalFees != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.TotalFees) + } + + h.update(&fill.Fill{ + Base: event.Base{ + Exchange: testExchange, + Time: time.Now(), + Interval: gctkline.OneHour, + CurrencyPair: currency.NewPair(currency.BTC, currency.USDT), + AssetType: asset.Spot, + }, + Direction: order.Sell, + Amount: 1, + ClosePrice: 500, + VolumeAdjustedPrice: 500, + PurchasePrice: 500, + ExchangeFee: 0, + Slippage: 0, + Order: &order.Detail{ + Price: 500, + Amount: 1, + Exchange: testExchange, + ID: "1337", + Type: order.Limit, + Side: order.Sell, + Status: order.New, + AssetType: asset.Spot, + Date: time.Now(), + CloseTime: time.Now(), + LastUpdated: time.Now(), + Pair: currency.NewPair(currency.BTC, currency.USDT), + Trades: nil, + Fee: 1, + }, + }) + + if h.PositionsSize != 0 { + t.Errorf("expected '%v' received '%v'", 0, h.PositionsSize) + } + if h.PositionsValue != 0 { + t.Errorf("expected '%v' received '%v'", 0, h.PositionsValue) + } + if h.InitialFunds != 1000 { + t.Errorf("expected '%v' received '%v'", 1000, h.InitialFunds) + } + if h.RemainingFunds != 998 { + t.Errorf("expected '%v' received '%v'", 998, h.RemainingFunds) + } + if h.TotalValue != 998 { + t.Errorf("expected '%v' received '%v'", 998, h.TotalValue) + } + if h.BoughtAmount != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.BoughtAmount) + } + if h.BoughtValue != 500 { + t.Errorf("expected '%v' received '%v'", 500, h.BoughtValue) + } + if h.SoldAmount != 1 { + t.Errorf("expected '%v' received '%v'", 1, h.SoldAmount) + } + if h.TotalFees != 2 { + t.Errorf("expected '%v' received '%v'", 2, h.TotalFees) + } +} diff --git a/backtester/eventhandlers/portfolio/holdings/holdings_types.go b/backtester/eventhandlers/portfolio/holdings/holdings_types.go new file mode 100644 index 00000000..08a68a92 --- /dev/null +++ b/backtester/eventhandlers/portfolio/holdings/holdings_types.go @@ -0,0 +1,45 @@ +package holdings + +import ( + "errors" + "time" + + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" +) + +// ErrInitialFundsZero is an error when initial funds are zero or less +var ErrInitialFundsZero = errors.New("initial funds <= 0") + +// Holding contains pricing statistics for a given time +// for a given exchange asset pair +type Holding struct { + Offset int64 + Pair currency.Pair `json:"pair"` + Asset asset.Item `json:"asset"` + Exchange string `json:"exchange"` + Timestamp time.Time `json:"timestamp"` + InitialFunds float64 `json:"initial-funds"` + PositionsSize float64 `json:"positions-size"` + PositionsValue float64 `json:"postions-value"` + SoldAmount float64 `json:"sold-amount"` + SoldValue float64 `json:"sold-value"` + BoughtAmount float64 `json:"bought-amount"` + BoughtValue float64 `json:"bought-value"` + RemainingFunds float64 `json:"remaining-funds"` + CommittedFunds float64 `json:"committed-funds"` + + TotalValueDifference float64 + ChangeInTotalValuePercent float64 + BoughtValueDifference float64 + SoldValueDifference float64 + PositionsValueDifference float64 + + TotalValue float64 `json:"total-value"` + TotalFees float64 `json:"total-fees"` + TotalValueLostToVolumeSizing float64 `json:"total-value-lost-to-volume-sizing"` + TotalValueLostToSlippage float64 `json:"total-value-lost-to-slippage"` + TotalValueLost float64 `json:"total-value-lost"` + + RiskFreeRate float64 `json:"risk-free-rate"` +} diff --git a/backtester/eventhandlers/portfolio/portfolio.go b/backtester/eventhandlers/portfolio/portfolio.go new file mode 100644 index 00000000..622b70f9 --- /dev/null +++ b/backtester/eventhandlers/portfolio/portfolio.go @@ -0,0 +1,449 @@ +package portfolio + +import ( + "errors" + "fmt" + "math" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/risk" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/settings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// Setup creates a portfolio manager instance and sets private fields +func Setup(sh SizeHandler, r risk.Handler, riskFreeRate float64) (*Portfolio, error) { + if sh == nil { + return nil, errSizeManagerUnset + } + if riskFreeRate < 0 { + return nil, errNegativeRiskFreeRate + } + if r == nil { + return nil, errRiskManagerUnset + } + p := &Portfolio{} + p.sizeManager = sh + p.riskManager = r + p.riskFreeRate = riskFreeRate + + return p, nil +} + +// Reset returns the portfolio manager to its default state +func (p *Portfolio) Reset() { + p.exchangeAssetPairSettings = nil +} + +// OnSignal receives the event from the strategy on whether it has signalled to buy, do nothing or sell +// on buy/sell, the portfolio manager will size the order and assess the risk of the order +// if successful, it will pass on an order.Order to be used by the exchange event handler to place an order based on +// the portfolio manager's recommendations +func (p *Portfolio) OnSignal(signal signal.Event, cs *exchange.Settings) (*order.Order, error) { + if signal == nil || cs == nil { + return nil, common.ErrNilArguments + } + if p.sizeManager == nil { + return nil, errSizeManagerUnset + } + if p.riskManager == nil { + return nil, errRiskManagerUnset + } + + o := &order.Order{ + Base: event.Base{ + Offset: signal.GetOffset(), + Exchange: signal.GetExchange(), + Time: signal.GetTime(), + CurrencyPair: signal.Pair(), + AssetType: signal.GetAssetType(), + Interval: signal.GetInterval(), + Reason: signal.GetReason(), + }, + Direction: signal.GetDirection(), + } + if signal.GetDirection() == "" { + return o, errInvalidDirection + } + + lookup := p.exchangeAssetPairSettings[signal.GetExchange()][signal.GetAssetType()][signal.Pair()] + if lookup == nil { + return nil, fmt.Errorf("%w for %v %v %v", + errNoPortfolioSettings, + signal.GetExchange(), + signal.GetAssetType(), + signal.Pair()) + } + prevHolding := lookup.GetLatestHoldings() + if p.iteration == 0 { + prevHolding.InitialFunds = lookup.InitialFunds + prevHolding.RemainingFunds = lookup.InitialFunds + prevHolding.Exchange = signal.GetExchange() + prevHolding.Pair = signal.Pair() + prevHolding.Asset = signal.GetAssetType() + prevHolding.Timestamp = signal.GetTime() + } + p.iteration++ + + if signal.GetDirection() == common.DoNothing || signal.GetDirection() == common.MissingData || signal.GetDirection() == "" { + return o, nil + } + + if signal.GetDirection() == gctorder.Sell && prevHolding.PositionsSize == 0 { + o.AppendReason("no holdings to sell") + o.SetDirection(common.CouldNotSell) + signal.SetDirection(o.Direction) + return o, nil + } + + // for simplicity, the backtester will round to 8 decimal places + remainingFundsRounded := math.Floor(prevHolding.RemainingFunds*100000000) / 100000000 + if signal.GetDirection() == gctorder.Buy && remainingFundsRounded <= 0 { + o.AppendReason("not enough funds to buy") + o.SetDirection(common.CouldNotBuy) + signal.SetDirection(o.Direction) + return o, nil + } + + o.Price = signal.GetPrice() + o.OrderType = gctorder.Market + sizingFunds := prevHolding.RemainingFunds + if signal.GetDirection() == gctorder.Sell { + sizingFunds = prevHolding.PositionsSize + } + + sizedOrder := p.sizeOrder(signal, cs, o, sizingFunds) + o.Funds = sizingFunds + sizedAmountRounded := math.Floor(sizedOrder.Amount*100000000) / 100000000 + if sizedAmountRounded <= 0 { + o.AppendReason("sized amount is zero") + if o.Direction == gctorder.Buy { + o.SetDirection(common.CouldNotBuy) + } else if o.Direction == gctorder.Sell { + o.SetDirection(common.CouldNotSell) + } + return o, nil + } + + return p.evaluateOrder(signal, o, sizedOrder) +} + +func (p *Portfolio) evaluateOrder(d common.Directioner, originalOrderSignal, sizedOrder *order.Order) (*order.Order, error) { + var evaluatedOrder *order.Order + cm, err := p.GetComplianceManager(originalOrderSignal.GetExchange(), originalOrderSignal.GetAssetType(), originalOrderSignal.Pair()) + if err != nil { + return nil, err + } + + evaluatedOrder, err = p.riskManager.EvaluateOrder(sizedOrder, p.GetLatestHoldingsForAllCurrencies(), cm.GetLatestSnapshot()) + if err != nil { + originalOrderSignal.AppendReason(err.Error()) + switch d.GetDirection() { + case gctorder.Buy: + originalOrderSignal.Direction = common.CouldNotBuy + case gctorder.Sell: + originalOrderSignal.Direction = common.CouldNotSell + case common.CouldNotBuy, common.CouldNotSell: + default: + originalOrderSignal.Direction = common.DoNothing + } + d.SetDirection(originalOrderSignal.Direction) + return originalOrderSignal, nil + } + + return evaluatedOrder, nil +} + +func (p *Portfolio) sizeOrder(d common.Directioner, cs *exchange.Settings, originalOrderSignal *order.Order, sizingFunds float64) *order.Order { + sizedOrder, err := p.sizeManager.SizeOrder(originalOrderSignal, sizingFunds, cs) + if err != nil { + originalOrderSignal.AppendReason(err.Error()) + switch originalOrderSignal.Direction { + case gctorder.Buy: + originalOrderSignal.Direction = common.CouldNotBuy + case gctorder.Sell: + originalOrderSignal.Direction = common.CouldNotSell + default: + originalOrderSignal.Direction = common.DoNothing + } + d.SetDirection(originalOrderSignal.Direction) + return originalOrderSignal + } + + if sizedOrder.Amount == 0 { + switch originalOrderSignal.Direction { + case gctorder.Buy: + originalOrderSignal.Direction = common.CouldNotBuy + case gctorder.Sell: + originalOrderSignal.Direction = common.CouldNotSell + default: + originalOrderSignal.Direction = common.DoNothing + } + d.SetDirection(originalOrderSignal.Direction) + originalOrderSignal.AppendReason("sized order to 0") + } + + return sizedOrder +} + +// OnFill processes the event after an order has been placed by the exchange. Its purpose is to track holdings for future portfolio decisions. +func (p *Portfolio) OnFill(fillEvent fill.Event) (*fill.Fill, error) { + if fillEvent == nil { + return nil, common.ErrNilEvent + } + lookup := p.exchangeAssetPairSettings[fillEvent.GetExchange()][fillEvent.GetAssetType()][fillEvent.Pair()] + if lookup == nil { + return nil, fmt.Errorf("%w for %v %v %v", errNoPortfolioSettings, fillEvent.GetExchange(), fillEvent.GetAssetType(), fillEvent.Pair()) + } + var err error + // Get the holding from the previous iteration, create it if it doesn't yet have a timestamp + h := lookup.GetHoldingsForTime(fillEvent.GetTime().Add(-fillEvent.GetInterval().Duration())) + if !h.Timestamp.IsZero() { + h.Update(fillEvent) + } else { + h = lookup.GetLatestHoldings() + if !h.Timestamp.IsZero() { + h.Update(fillEvent) + } else { + h, err = holdings.Create(fillEvent, lookup.InitialFunds, p.riskFreeRate) + if err != nil { + return nil, err + } + } + } + err = p.setHoldingsForOffset(fillEvent.GetExchange(), fillEvent.GetAssetType(), fillEvent.Pair(), &h, true) + if errors.Is(err, errNoHoldings) { + err = p.setHoldingsForOffset(fillEvent.GetExchange(), fillEvent.GetAssetType(), fillEvent.Pair(), &h, false) + } + if err != nil { + log.Error(log.BackTester, err) + } + + err = p.addComplianceSnapshot(fillEvent) + if err != nil { + log.Error(log.BackTester, err) + } + + direction := fillEvent.GetDirection() + if direction == common.DoNothing || + direction == common.CouldNotBuy || + direction == common.CouldNotSell || + direction == common.MissingData || + direction == "" { + fe := fillEvent.(*fill.Fill) + fe.ExchangeFee = 0 + return fe, nil + } + + return fillEvent.(*fill.Fill), nil +} + +// addComplianceSnapshot gets the previous snapshot of compliance events, updates with the latest fillevent +// then saves the snapshot to the c +func (p *Portfolio) addComplianceSnapshot(fillEvent fill.Event) error { + if fillEvent == nil { + return common.ErrNilEvent + } + complianceManager, err := p.GetComplianceManager(fillEvent.GetExchange(), fillEvent.GetAssetType(), fillEvent.Pair()) + if err != nil { + return err + } + prevSnap := complianceManager.GetLatestSnapshot() + fo := fillEvent.GetOrder() + if fo != nil { + snapOrder := compliance.SnapshotOrder{ + ClosePrice: fillEvent.GetClosePrice(), + VolumeAdjustedPrice: fillEvent.GetVolumeAdjustedPrice(), + SlippageRate: fillEvent.GetSlippageRate(), + Detail: fo, + CostBasis: (fo.Price * fo.Amount) + fo.Fee, + } + prevSnap.Orders = append(prevSnap.Orders, snapOrder) + } + return complianceManager.AddSnapshot(prevSnap.Orders, fillEvent.GetTime(), fillEvent.GetOffset(), false) +} + +// GetComplianceManager returns the order snapshots for a given exchange, asset, pair +func (p *Portfolio) GetComplianceManager(exchangeName string, a asset.Item, cp currency.Pair) (*compliance.Manager, error) { + lookup := p.exchangeAssetPairSettings[exchangeName][a][cp] + if lookup == nil { + return nil, fmt.Errorf("%w for %v %v %v could not retrieve compliance manager", errNoPortfolioSettings, exchangeName, a, cp) + } + return &lookup.ComplianceManager, nil +} + +// SetFee sets the fee rate +func (p *Portfolio) SetFee(exch string, a asset.Item, cp currency.Pair, fee float64) { + lookup := p.exchangeAssetPairSettings[exch][a][cp] + lookup.Fee = fee +} + +// GetFee can panic for bad requests, but why are you getting things that don't exist? +func (p *Portfolio) GetFee(exchangeName string, a asset.Item, cp currency.Pair) float64 { + if p.exchangeAssetPairSettings == nil { + return 0 + } + lookup := p.exchangeAssetPairSettings[exchangeName][a][cp] + if lookup == nil { + return 0 + } + return lookup.Fee +} + +// IsInvested determines if there are any holdings for a given exchange, asset, pair +func (p *Portfolio) IsInvested(exchangeName string, a asset.Item, cp currency.Pair) (holdings.Holding, bool) { + s := p.exchangeAssetPairSettings[exchangeName][a][cp] + if s == nil { + return holdings.Holding{}, false + } + h := s.GetLatestHoldings() + if h.PositionsSize > 0 { + return h, true + } + return h, false +} + +// Update updates the portfolio holdings for the data event +func (p *Portfolio) Update(d common.DataEventHandler) error { + if d == nil { + return common.ErrNilEvent + } + h, ok := p.IsInvested(d.GetExchange(), d.GetAssetType(), d.Pair()) + if !ok { + return nil + } + h.UpdateValue(d) + err := p.setHoldingsForOffset(d.GetExchange(), d.GetAssetType(), d.Pair(), &h, true) + if errors.Is(err, errNoHoldings) { + err = p.setHoldingsForOffset(d.GetExchange(), d.GetAssetType(), d.Pair(), &h, false) + } + return err +} + +// SetInitialFunds sets the initial funds +func (p *Portfolio) SetInitialFunds(exch string, a asset.Item, cp currency.Pair, funds float64) error { + lookup, ok := p.exchangeAssetPairSettings[exch][a][cp] + if !ok { + var err error + lookup, err = p.SetupCurrencySettingsMap(exch, a, cp) + if err != nil { + return err + } + } + lookup.InitialFunds = funds + + return nil +} + +// GetInitialFunds returns the initial funds +func (p *Portfolio) GetInitialFunds(exch string, a asset.Item, cp currency.Pair) float64 { + lookup, ok := p.exchangeAssetPairSettings[exch][a][cp] + if !ok { + return 0 + } + return lookup.InitialFunds +} + +// GetLatestHoldingsForAllCurrencies will return the current holdings for all loaded currencies +// this is useful to assess the position of your entire portfolio in order to help with risk decisions +func (p *Portfolio) GetLatestHoldingsForAllCurrencies() []holdings.Holding { + var resp []holdings.Holding + for _, x := range p.exchangeAssetPairSettings { + for _, y := range x { + for _, z := range y { + holds := z.GetLatestHoldings() + if holds.Offset != 0 { + resp = append(resp, holds) + } + } + } + } + return resp +} + +func (p *Portfolio) setHoldingsForOffset(exch string, a asset.Item, cp currency.Pair, h *holdings.Holding, overwriteExisting bool) error { + if h.Timestamp.IsZero() { + return errHoldingsNoTimestamp + } + lookup := p.exchangeAssetPairSettings[exch][a][cp] + if lookup == nil { + var err error + lookup, err = p.SetupCurrencySettingsMap(exch, a, cp) + if err != nil { + return err + } + } + if overwriteExisting && len(lookup.HoldingsSnapshots) == 0 { + return errNoHoldings + } + for i := len(lookup.HoldingsSnapshots) - 1; i >= 0; i-- { + if lookup.HoldingsSnapshots[i].Offset == h.Offset { + if overwriteExisting { + lookup.HoldingsSnapshots[i] = *h + return nil + } + return errHoldingsAlreadySet + } + } + if overwriteExisting { + return fmt.Errorf("%w at %v", errNoHoldings, h.Timestamp) + } + + lookup.HoldingsSnapshots = append(lookup.HoldingsSnapshots, *h) + return nil +} + +// ViewHoldingAtTimePeriod retrieves a snapshot of holdings at a specific time period, +// returning empty when not found +func (p *Portfolio) ViewHoldingAtTimePeriod(exch string, a asset.Item, cp currency.Pair, t time.Time) (holdings.Holding, error) { + exchangeAssetPairSettings := p.exchangeAssetPairSettings[exch][a][cp] + if exchangeAssetPairSettings == nil { + return holdings.Holding{}, fmt.Errorf("%w for %v %v %v", errNoHoldings, exch, a, cp) + } + + for i := len(exchangeAssetPairSettings.HoldingsSnapshots) - 1; i >= 0; i-- { + if t.Equal(exchangeAssetPairSettings.HoldingsSnapshots[i].Timestamp) { + return exchangeAssetPairSettings.HoldingsSnapshots[i], nil + } + } + + return holdings.Holding{}, fmt.Errorf("%w for %v %v %v at %v", errNoHoldings, exch, a, cp, t) +} + +// SetupCurrencySettingsMap ensures a map is created and no panics happen +func (p *Portfolio) SetupCurrencySettingsMap(exch string, a asset.Item, cp currency.Pair) (*settings.Settings, error) { + if exch == "" { + return nil, errExchangeUnset + } + if a == "" { + return nil, errAssetUnset + } + if cp.IsEmpty() { + return nil, errCurrencyPairUnset + } + if p.exchangeAssetPairSettings == nil { + p.exchangeAssetPairSettings = make(map[string]map[asset.Item]map[currency.Pair]*settings.Settings) + } + if p.exchangeAssetPairSettings[exch] == nil { + p.exchangeAssetPairSettings[exch] = make(map[asset.Item]map[currency.Pair]*settings.Settings) + } + if p.exchangeAssetPairSettings[exch][a] == nil { + p.exchangeAssetPairSettings[exch][a] = make(map[currency.Pair]*settings.Settings) + } + if _, ok := p.exchangeAssetPairSettings[exch][a][cp]; !ok { + p.exchangeAssetPairSettings[exch][a][cp] = &settings.Settings{} + } + + return p.exchangeAssetPairSettings[exch][a][cp], nil +} diff --git a/backtester/eventhandlers/portfolio/portfolio_test.go b/backtester/eventhandlers/portfolio/portfolio_test.go new file mode 100644 index 00000000..3f61f32e --- /dev/null +++ b/backtester/eventhandlers/portfolio/portfolio_test.go @@ -0,0 +1,469 @@ +package portfolio + +import ( + "errors" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/risk" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/settings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/size" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const testExchange = "binance" + +func TestReset(t *testing.T) { + t.Parallel() + p := Portfolio{ + exchangeAssetPairSettings: make(map[string]map[asset.Item]map[currency.Pair]*settings.Settings), + } + p.Reset() + if p.exchangeAssetPairSettings != nil { + t.Error("expected nil") + } +} + +func TestSetup(t *testing.T) { + t.Parallel() + _, err := Setup(nil, nil, -1) + if !errors.Is(err, errSizeManagerUnset) { + t.Errorf("expected: %v, received %v", errSizeManagerUnset, err) + } + + _, err = Setup(&size.Size{}, nil, -1) + if !errors.Is(err, errNegativeRiskFreeRate) { + t.Errorf("expected: %v, received %v", errNegativeRiskFreeRate, err) + } + + _, err = Setup(&size.Size{}, nil, 1) + if !errors.Is(err, errRiskManagerUnset) { + t.Errorf("expected: %v, received %v", errRiskManagerUnset, err) + } + var p *Portfolio + p, err = Setup(&size.Size{}, &risk.Risk{}, 1) + if err != nil { + t.Error(err) + } + if p.riskFreeRate != 1 { + t.Error("expected 1") + } +} + +func TestSetupCurrencySettingsMap(t *testing.T) { + t.Parallel() + p := &Portfolio{} + _, err := p.SetupCurrencySettingsMap("", "", currency.Pair{}) + if !errors.Is(err, errExchangeUnset) { + t.Errorf("expected: %v, received %v", errExchangeUnset, err) + } + + _, err = p.SetupCurrencySettingsMap("hi", "", currency.Pair{}) + if !errors.Is(err, errAssetUnset) { + t.Errorf("expected: %v, received %v", errAssetUnset, err) + } + + _, err = p.SetupCurrencySettingsMap("hi", asset.Spot, currency.Pair{}) + if !errors.Is(err, errCurrencyPairUnset) { + t.Errorf("expected: %v, received %v", errCurrencyPairUnset, err) + } + + _, err = p.SetupCurrencySettingsMap("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if err != nil { + t.Error(err) + } +} + +func TestSetHoldings(t *testing.T) { + t.Parallel() + p := &Portfolio{} + + err := p.setHoldingsForOffset("", "", currency.Pair{}, &holdings.Holding{}, false) + if !errors.Is(err, errHoldingsNoTimestamp) { + t.Errorf("expected: %v, received %v", errHoldingsNoTimestamp, err) + } + tt := time.Now() + + err = p.setHoldingsForOffset("", "", currency.Pair{}, &holdings.Holding{Timestamp: tt}, false) + if !errors.Is(err, errExchangeUnset) { + t.Errorf("expected: %v, received %v", errExchangeUnset, err) + } + + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), &holdings.Holding{Timestamp: tt}, false) + if err != nil { + t.Error(err) + } + + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), &holdings.Holding{Timestamp: tt}, true) + if err != nil { + t.Error(err) + } +} + +func TestGetLatestHoldingsForAllCurrencies(t *testing.T) { + t.Parallel() + p := &Portfolio{} + h := p.GetLatestHoldingsForAllCurrencies() + if len(h) != 0 { + t.Error("expected 0") + } + tt := time.Now() + err := p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), &holdings.Holding{Timestamp: tt}, true) + if !errors.Is(err, errNoHoldings) { + t.Errorf("expected: %v, received %v", errNoHoldings, err) + } + h = p.GetLatestHoldingsForAllCurrencies() + if len(h) != 1 { + t.Error("expected 1") + } + if !h[0].Timestamp.IsZero() { + t.Error("expected unset holding") + } + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.DOGE), &holdings.Holding{Offset: 1, Timestamp: tt}, false) + if err != nil { + t.Error(err) + } + h = p.GetLatestHoldingsForAllCurrencies() + if len(h) != 2 { + t.Error("expected 2") + } + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.DOGE), &holdings.Holding{Offset: 1, Timestamp: tt}, false) + if !errors.Is(err, errHoldingsAlreadySet) { + t.Errorf("expected: %v, received %v", errHoldingsAlreadySet, err) + } + + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.DOGE), &holdings.Holding{Offset: 2, Timestamp: tt.Add(time.Minute)}, true) + if !errors.Is(err, errNoHoldings) { + t.Errorf("expected: %v, received %v", errNoHoldings, err) + } + h = p.GetLatestHoldingsForAllCurrencies() + if len(h) != 2 { + t.Error("expected 2") + } +} + +func TestGetInitialFunds(t *testing.T) { + t.Parallel() + p := Portfolio{} + f := p.GetInitialFunds("", "", currency.Pair{}) + if f != 0 { + t.Error("expected zero") + } + + err := p.SetInitialFunds("", "", currency.Pair{}, 1) + if !errors.Is(err, errExchangeUnset) { + t.Errorf("expected: %v, received %v", errExchangeUnset, err) + } + + err = p.SetInitialFunds(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.DOGE), 1) + if err != nil { + t.Error(err) + } + + f = p.GetInitialFunds(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.DOGE)) + if f != 1 { + t.Error("expected 1") + } +} + +func TestViewHoldingAtTimePeriod(t *testing.T) { + t.Parallel() + p := Portfolio{} + tt := time.Now() + _, err := p.ViewHoldingAtTimePeriod("", "", currency.Pair{}, tt) + if !errors.Is(err, errNoHoldings) { + t.Errorf("expected: %v, received %v", errNoHoldings, err) + } + + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), &holdings.Holding{Offset: 1, Timestamp: tt}, false) + if err != nil { + t.Error(err) + } + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), &holdings.Holding{Offset: 2, Timestamp: tt.Add(time.Hour)}, false) + if err != nil { + t.Error(err) + } + _, err = p.ViewHoldingAtTimePeriod(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), tt) + if err != nil { + t.Error(err) + } + + var h holdings.Holding + h, err = p.ViewHoldingAtTimePeriod(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), tt) + if err != nil { + t.Error(err) + } + if !h.Timestamp.Equal(tt) { + t.Errorf("expected %v received %v", tt, h.Timestamp) + } +} + +func TestUpdate(t *testing.T) { + t.Parallel() + p := Portfolio{} + err := p.Update(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + + err = p.Update(&kline.Kline{}) + if err != nil { + t.Error(err) + } + + err = p.Update(&kline.Kline{ + Base: event.Base{ + Exchange: testExchange, + CurrencyPair: currency.NewPair(currency.BTC, currency.USD), + AssetType: asset.Spot, + }, + }) + if err != nil { + t.Error(err) + } + + tt := time.Now() + err = p.setHoldingsForOffset(testExchange, asset.Spot, currency.NewPair(currency.BTC, currency.USD), &holdings.Holding{Timestamp: tt, PositionsSize: 1337}, false) + if err != nil { + t.Error(err) + } + + err = p.Update(&kline.Kline{ + Base: event.Base{ + Exchange: testExchange, + CurrencyPair: currency.NewPair(currency.BTC, currency.USD), + AssetType: asset.Spot, + Time: tt, + }, + }) + if err != nil { + t.Error(err) + } +} + +func TestGetFee(t *testing.T) { + t.Parallel() + p := Portfolio{} + f := p.GetFee("", "", currency.Pair{}) + if f != 0 { + t.Error("expected 0") + } + + _, err := p.SetupCurrencySettingsMap("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if err != nil { + t.Error(err) + } + + p.SetFee("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD), 1337) + f = p.GetFee("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if f != 1337 { + t.Error("expected 1337") + } +} + +func TestGetComplianceManager(t *testing.T) { + t.Parallel() + p := Portfolio{} + _, err := p.GetComplianceManager("", "", currency.Pair{}) + if !errors.Is(err, errNoPortfolioSettings) { + t.Errorf("expected: %v, received %v", errNoPortfolioSettings, err) + } + + _, err = p.SetupCurrencySettingsMap("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if err != nil { + t.Error(err) + } + var cm *compliance.Manager + cm, err = p.GetComplianceManager("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if err != nil { + t.Error(err) + } + if cm == nil { + t.Error("expected not nil") + } +} + +func TestAddComplianceSnapshot(t *testing.T) { + t.Parallel() + p := Portfolio{} + err := p.addComplianceSnapshot(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + + err = p.addComplianceSnapshot(&fill.Fill{}) + if !errors.Is(err, errNoPortfolioSettings) { + t.Errorf("expected: %v, received %v", errNoPortfolioSettings, err) + } + + _, err = p.SetupCurrencySettingsMap("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if err != nil { + t.Error(err) + } + + err = p.addComplianceSnapshot(&fill.Fill{ + Base: event.Base{ + Exchange: "hi", + CurrencyPair: currency.NewPair(currency.BTC, currency.USD), + AssetType: asset.Spot, + }, + Order: &gctorder.Detail{ + Exchange: "hi", + Pair: currency.NewPair(currency.BTC, currency.USD), + AssetType: asset.Spot, + }, + }) + if err != nil { + t.Error(err) + } +} + +func TestOnFill(t *testing.T) { + t.Parallel() + p := Portfolio{} + _, err := p.OnFill(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + + f := &fill.Fill{ + Base: event.Base{ + Exchange: "hi", + CurrencyPair: currency.NewPair(currency.BTC, currency.USD), + AssetType: asset.Spot, + }, + Order: &gctorder.Detail{ + Exchange: "hi", + Pair: currency.NewPair(currency.BTC, currency.USD), + AssetType: asset.Spot, + }, + } + _, err = p.OnFill(f) + if !errors.Is(err, errNoPortfolioSettings) { + t.Errorf("expected: %v, received %v", errNoPortfolioSettings, err) + } + var s *settings.Settings + s, err = p.SetupCurrencySettingsMap("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if err != nil { + t.Error(err) + } + _, err = p.OnFill(f) + if !errors.Is(err, holdings.ErrInitialFundsZero) { + t.Errorf("expected: %v, received %v", holdings.ErrInitialFundsZero, err) + } + + s.InitialFunds = 1337 + _, err = p.OnFill(f) + if err != nil { + t.Error(err) + } + + f.Direction = gctorder.Buy + _, err = p.OnFill(f) + if err != nil { + t.Error(err) + } +} + +func TestOnSignal(t *testing.T) { + t.Parallel() + p := Portfolio{} + _, err := p.OnSignal(nil, nil) + if !errors.Is(err, common.ErrNilArguments) { + t.Error(err) + } + + s := &signal.Signal{} + _, err = p.OnSignal(s, &exchange.Settings{}) + if !errors.Is(err, errSizeManagerUnset) { + t.Errorf("expected: %v, received %v", errSizeManagerUnset, err) + } + p.sizeManager = &size.Size{} + + _, err = p.OnSignal(s, &exchange.Settings{}) + if !errors.Is(err, errRiskManagerUnset) { + t.Errorf("expected: %v, received %v", errRiskManagerUnset, err) + } + + p.riskManager = &risk.Risk{} + + _, err = p.OnSignal(s, &exchange.Settings{}) + if !errors.Is(err, errInvalidDirection) { + t.Errorf("expected: %v, received %v", errInvalidDirection, err) + } + + s.Direction = gctorder.Buy + _, err = p.OnSignal(s, &exchange.Settings{}) + if !errors.Is(err, errNoPortfolioSettings) { + t.Errorf("expected: %v, received %v", errNoPortfolioSettings, err) + } + _, err = p.SetupCurrencySettingsMap("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD)) + if err != nil { + t.Error(err) + } + s = &signal.Signal{ + Base: event.Base{ + Exchange: "hi", + CurrencyPair: currency.NewPair(currency.BTC, currency.USD), + AssetType: asset.Spot, + }, + Direction: gctorder.Buy, + } + var resp *order.Order + resp, err = p.OnSignal(s, &exchange.Settings{}) + if err != nil { + t.Error(err) + } + if resp.Reason == "" { + t.Error("expected issue") + } + + s.Direction = gctorder.Sell + _, err = p.OnSignal(s, &exchange.Settings{}) + if err != nil { + t.Error(err) + } + if resp.Reason == "" { + t.Error("expected issue") + } + + s.Direction = common.MissingData + _, err = p.OnSignal(s, &exchange.Settings{}) + if err != nil { + t.Error(err) + } + + s.Direction = gctorder.Buy + err = p.setHoldingsForOffset("hi", asset.Spot, currency.NewPair(currency.BTC, currency.USD), &holdings.Holding{Timestamp: time.Now(), RemainingFunds: 1337}, false) + if err != nil { + t.Error(err) + } + resp, err = p.OnSignal(s, &exchange.Settings{}) + if err != nil { + t.Error(err) + } + if resp.Direction != common.CouldNotBuy { + t.Errorf("expected common.CouldNotBuy, received %v", resp.Direction) + } + + s.ClosePrice = 10 + s.Direction = gctorder.Buy + resp, err = p.OnSignal(s, &exchange.Settings{}) + if err != nil { + t.Error(err) + } + if resp.Amount == 0 { + t.Error("expected an amount to be sized") + } +} diff --git a/backtester/eventhandlers/portfolio/portfolio_types.go b/backtester/eventhandlers/portfolio/portfolio_types.go new file mode 100644 index 00000000..69fd6c57 --- /dev/null +++ b/backtester/eventhandlers/portfolio/portfolio_types.go @@ -0,0 +1,65 @@ +package portfolio + +import ( + "errors" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/risk" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/settings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" +) + +var ( + errInvalidDirection = errors.New("invalid direction") + errRiskManagerUnset = errors.New("risk manager unset") + errSizeManagerUnset = errors.New("size manager unset") + errAssetUnset = errors.New("asset unset") + errCurrencyPairUnset = errors.New("currency pair unset") + errExchangeUnset = errors.New("exchange unset") + errNegativeRiskFreeRate = errors.New("received negative risk free rate") + errNoPortfolioSettings = errors.New("no portfolio settings") + errNoHoldings = errors.New("no holdings found") + errHoldingsNoTimestamp = errors.New("holding with unset timestamp received") + errHoldingsAlreadySet = errors.New("holding already set") +) + +// Portfolio stores all holdings and rules to assess orders, allowing the portfolio manager to +// modify, accept or reject strategy signals +type Portfolio struct { + iteration float64 + riskFreeRate float64 + sizeManager SizeHandler + riskManager risk.Handler + exchangeAssetPairSettings map[string]map[asset.Item]map[currency.Pair]*settings.Settings +} + +// Handler contains all functions expected to operate a portfolio manager +type Handler interface { + OnSignal(signal.Event, *exchange.Settings) (*order.Order, error) + OnFill(fill.Event) (*fill.Fill, error) + Update(common.DataEventHandler) error + + SetInitialFunds(string, asset.Item, currency.Pair, float64) error + GetInitialFunds(string, asset.Item, currency.Pair) float64 + + GetComplianceManager(string, asset.Item, currency.Pair) (*compliance.Manager, error) + + setHoldingsForOffset(string, asset.Item, currency.Pair, *holdings.Holding, bool) error + ViewHoldingAtTimePeriod(string, asset.Item, currency.Pair, time.Time) (holdings.Holding, error) + SetFee(string, asset.Item, currency.Pair, float64) + GetFee(string, asset.Item, currency.Pair) float64 + Reset() +} + +// SizeHandler is the interface to help size orders +type SizeHandler interface { + SizeOrder(order.Event, float64, *exchange.Settings) (*order.Order, error) +} diff --git a/backtester/eventhandlers/portfolio/risk/README.md b/backtester/eventhandlers/portfolio/risk/README.md new file mode 100644 index 00000000..b27e1ba3 --- /dev/null +++ b/backtester/eventhandlers/portfolio/risk/README.md @@ -0,0 +1,48 @@ +# GoCryptoTrader Backtester: Risk package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/risk) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This risk package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Risk package overview + +The risk manager is responsible for ensuring that no order can be made if it is deemed too risky. +Risk is currently defined by ensuring that orders cannot have too much leverage for the individual order, overall with all orders in the portfolio as well as whether there are too many orders for an individual currency + +See config package [readme](/backtester/config/README.md) to view the risk related fields to customise + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/portfolio/risk/risk.go b/backtester/eventhandlers/portfolio/risk/risk.go new file mode 100644 index 00000000..bae4d8c6 --- /dev/null +++ b/backtester/eventhandlers/portfolio/risk/risk.go @@ -0,0 +1,79 @@ +package risk + +import ( + "fmt" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/currency" +) + +// EvaluateOrder goes through a standard list of evaluations to make to ensure that +// we are in a position to follow through with an order +func (r *Risk) EvaluateOrder(o order.Event, latestHoldings []holdings.Holding, s compliance.Snapshot) (*order.Order, error) { + if o == nil || latestHoldings == nil { + return nil, common.ErrNilArguments + } + retOrder := o.(*order.Order) + ex := o.GetExchange() + a := o.GetAssetType() + p := o.Pair() + lookup, ok := r.CurrencySettings[ex][a][p] + if !ok { + return nil, fmt.Errorf("%v %v %v %w", ex, a, p, errNoCurrencySettings) + } + + if o.IsLeveraged() { + if !r.CanUseLeverage { + return nil, errLeverageNotAllowed + } + ratio := existingLeverageRatio(s) + if ratio > lookup.MaximumOrdersWithLeverageRatio && lookup.MaximumOrdersWithLeverageRatio > 0 { + return nil, fmt.Errorf("proceeding with the order would put maximum orders using leverage ratio beyond its limit of %v to %v and %w", lookup.MaximumOrdersWithLeverageRatio, ratio, errCannotPlaceLeverageOrder) + } + if retOrder.GetLeverage() > lookup.MaxLeverageRate && lookup.MaxLeverageRate > 0 { + return nil, fmt.Errorf("proceeding with the order would put leverage rate beyond its limit of %v to %v and %w", lookup.MaxLeverageRate, retOrder.GetLeverage(), errCannotPlaceLeverageOrder) + } + } + if len(latestHoldings) > 1 { + ratio := assessHoldingsRatio(o.Pair(), latestHoldings) + if lookup.MaximumHoldingRatio > 0 && ratio != 1 && ratio > lookup.MaximumHoldingRatio { + return nil, fmt.Errorf("order would exceed maximum holding ratio of %v to %v for %v %v %v. %w", lookup.MaximumHoldingRatio, ratio, ex, a, p, errCannotPlaceLeverageOrder) + } + } + return retOrder, nil +} + +// existingLeverageRatio compares orders with leverage to the total number of orders +// a proof of concept to demonstrate risk manager's ability to prevent an order from being placed +// when an order exceeds a config setting +func existingLeverageRatio(s compliance.Snapshot) float64 { + if len(s.Orders) == 0 { + return 0 + } + var ordersWithLeverage float64 + for o := range s.Orders { + if s.Orders[o].Leverage != 0 { + ordersWithLeverage++ + } + } + return ordersWithLeverage / float64(len(s.Orders)) +} + +func assessHoldingsRatio(c currency.Pair, h []holdings.Holding) float64 { + resp := make(map[currency.Pair]float64) + totalPosition := 0.0 + for i := range h { + resp[h[i].Pair] += h[i].PositionsValue + totalPosition += h[i].PositionsValue + } + + if totalPosition == 0 { + return 0 + } + ratio := resp[c] / totalPosition + + return ratio +} diff --git a/backtester/eventhandlers/portfolio/risk/risk_test.go b/backtester/eventhandlers/portfolio/risk/risk_test.go new file mode 100644 index 00000000..8f9a35d9 --- /dev/null +++ b/backtester/eventhandlers/portfolio/risk/risk_test.go @@ -0,0 +1,141 @@ +package risk + +import ( + "errors" + "testing" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +func TestAssessHoldingsRatio(t *testing.T) { + t.Parallel() + ratio := assessHoldingsRatio(currency.NewPair(currency.BTC, currency.USDT), []holdings.Holding{ + { + Pair: currency.NewPair(currency.BTC, currency.USDT), + PositionsValue: 2, + }, + { + Pair: currency.NewPair(currency.LTC, currency.USDT), + PositionsValue: 2, + }, + }) + if ratio != 0.5 { + t.Errorf("expected %v received %v", 0.5, ratio) + } + + ratio = assessHoldingsRatio(currency.NewPair(currency.BTC, currency.USDT), []holdings.Holding{ + { + Pair: currency.NewPair(currency.BTC, currency.USDT), + PositionsValue: 1, + }, + { + Pair: currency.NewPair(currency.LTC, currency.USDT), + PositionsValue: 2, + }, + { + Pair: currency.NewPair(currency.DOGE, currency.USDT), + PositionsValue: 1, + }, + }) + if ratio != 0.25 { + t.Errorf("expected %v received %v", 0.25, ratio) + } +} + +func TestEvaluateOrder(t *testing.T) { + t.Parallel() + r := Risk{} + _, err := r.EvaluateOrder(nil, nil, compliance.Snapshot{}) + if !errors.Is(err, common.ErrNilArguments) { + t.Error(err) + } + + o := &order.Order{} + h := []holdings.Holding{} + p := currency.NewPair(currency.BTC, currency.USDT) + e := "binance" + a := asset.Spot + o.Exchange = e + o.AssetType = a + o.CurrencyPair = p + r.CurrencySettings = make(map[string]map[asset.Item]map[currency.Pair]*CurrencySettings) + r.CurrencySettings[e] = make(map[asset.Item]map[currency.Pair]*CurrencySettings) + r.CurrencySettings[e][a] = make(map[currency.Pair]*CurrencySettings) + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{}) + if !errors.Is(err, errNoCurrencySettings) { + t.Error(err) + } + + r.CurrencySettings[e][a][p] = &CurrencySettings{ + MaximumOrdersWithLeverageRatio: 0.3, + MaxLeverageRate: 0.3, + MaximumHoldingRatio: 0.3, + } + + h = append(h, holdings.Holding{ + Pair: p, + PositionsSize: 1, + }) + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{}) + if err != nil { + t.Error(err) + } + + h = append(h, holdings.Holding{ + Pair: currency.NewPair(currency.DOGE, currency.USDT), + PositionsSize: 0, + }) + o.Leverage = 1.1 + r.CurrencySettings[e][a][p].MaximumHoldingRatio = 0 + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{}) + if !errors.Is(err, errLeverageNotAllowed) { + t.Error(err) + } + r.CanUseLeverage = true + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{}) + if !errors.Is(err, errCannotPlaceLeverageOrder) { + t.Error(err) + } + + r.MaximumLeverage = 33 + r.CurrencySettings[e][a][p].MaxLeverageRate = 33 + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{}) + if err != nil { + t.Error(err) + } + + r.MaximumLeverage = 33 + r.CurrencySettings[e][a][p].MaxLeverageRate = 33 + + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + Detail: &gctorder.Detail{ + Leverage: 3, + }, + }, + }, + }) + if !errors.Is(err, errCannotPlaceLeverageOrder) { + t.Error(err) + } + + h = append(h, holdings.Holding{Pair: p, PositionsValue: 1337}, holdings.Holding{Pair: p, PositionsValue: 1337.42}) + r.CurrencySettings[e][a][p].MaximumHoldingRatio = 0.1 + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{}) + if err != nil { + t.Error(err) + } + + h = append(h, holdings.Holding{Pair: currency.NewPair(currency.DOGE, currency.LTC), PositionsValue: 1337}) + _, err = r.EvaluateOrder(o, h, compliance.Snapshot{}) + if !errors.Is(err, errCannotPlaceLeverageOrder) { + t.Error(err) + } +} diff --git a/backtester/eventhandlers/portfolio/risk/risk_types.go b/backtester/eventhandlers/portfolio/risk/risk_types.go new file mode 100644 index 00000000..b2755ea7 --- /dev/null +++ b/backtester/eventhandlers/portfolio/risk/risk_types.go @@ -0,0 +1,36 @@ +package risk + +import ( + "errors" + + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" +) + +var ( + errNoCurrencySettings = errors.New("lacking currency settings, cannot evaluate order") + errLeverageNotAllowed = errors.New("order is using leverage when leverage is not enabled in config") + errCannotPlaceLeverageOrder = errors.New("cannot place leveraged order") +) + +// Handler defines what is expected to be able to assess risk of an order +type Handler interface { + EvaluateOrder(order.Event, []holdings.Holding, compliance.Snapshot) (*order.Order, error) +} + +// Risk contains all currency settings in order to evaluate potential orders +type Risk struct { + CurrencySettings map[string]map[asset.Item]map[currency.Pair]*CurrencySettings + CanUseLeverage bool + MaximumLeverage float64 +} + +// CurrencySettings contains relevant limits to assess risk +type CurrencySettings struct { + MaximumOrdersWithLeverageRatio float64 + MaxLeverageRate float64 + MaximumHoldingRatio float64 +} diff --git a/backtester/eventhandlers/portfolio/settings/settings.go b/backtester/eventhandlers/portfolio/settings/settings.go new file mode 100644 index 00000000..1668de89 --- /dev/null +++ b/backtester/eventhandlers/portfolio/settings/settings.go @@ -0,0 +1,37 @@ +package settings + +import ( + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" +) + +// GetLatestHoldings returns the latest holdings after being sorted by time +func (e *Settings) GetLatestHoldings() holdings.Holding { + if e.HoldingsSnapshots == nil { + // no holdings yet + return holdings.Holding{Offset: 1} + } + + return e.HoldingsSnapshots[len(e.HoldingsSnapshots)-1] +} + +// GetHoldingsForTime returns the holdings for a time period, or an empty holding if not found +func (e *Settings) GetHoldingsForTime(t time.Time) holdings.Holding { + if e.HoldingsSnapshots == nil { + // no holdings yet + return holdings.Holding{} + } + for i := len(e.HoldingsSnapshots) - 1; i >= 0; i-- { + if e.HoldingsSnapshots[i].Timestamp.Equal(t) { + return e.HoldingsSnapshots[i] + } + } + return holdings.Holding{} +} + +// Value returns the total value of the latest holdings +func (e *Settings) Value() float64 { + latest := e.GetLatestHoldings() + return latest.TotalValue +} diff --git a/backtester/eventhandlers/portfolio/settings/settings_test.go b/backtester/eventhandlers/portfolio/settings/settings_test.go new file mode 100644 index 00000000..cec71f31 --- /dev/null +++ b/backtester/eventhandlers/portfolio/settings/settings_test.go @@ -0,0 +1,39 @@ +package settings + +import ( + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" +) + +func TestGetLatestHoldings(t *testing.T) { + t.Parallel() + cs := Settings{} + h := cs.GetLatestHoldings() + if !h.Timestamp.IsZero() { + t.Error("expected zero time") + } + tt := time.Now() + cs.HoldingsSnapshots = append(cs.HoldingsSnapshots, holdings.Holding{Timestamp: tt}) + + h = cs.GetLatestHoldings() + if !h.Timestamp.Equal(tt) { + t.Errorf("expected %v, received %v", tt, h.Timestamp) + } +} + +func TestValue(t *testing.T) { + t.Parallel() + cs := Settings{} + v := cs.Value() + if v != 0 { + t.Error("expected 0") + } + cs.HoldingsSnapshots = append(cs.HoldingsSnapshots, holdings.Holding{TotalValue: 1337}) + + v = cs.Value() + if v != 1337 { + t.Errorf("expected %v, received %v", 1337, v) + } +} diff --git a/backtester/eventhandlers/portfolio/settings/settings_types.go b/backtester/eventhandlers/portfolio/settings/settings_types.go new file mode 100644 index 00000000..3dd63efe --- /dev/null +++ b/backtester/eventhandlers/portfolio/settings/settings_types.go @@ -0,0 +1,19 @@ +package settings + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" +) + +// Settings holds all important information for the portfolio manager +// to assess purchasing decisions +type Settings struct { + InitialFunds float64 + Fee float64 + BuySideSizing config.MinMax + SellSideSizing config.MinMax + Leverage config.Leverage + HoldingsSnapshots []holdings.Holding + ComplianceManager compliance.Manager +} diff --git a/backtester/eventhandlers/portfolio/size/README.md b/backtester/eventhandlers/portfolio/size/README.md new file mode 100644 index 00000000..35487002 --- /dev/null +++ b/backtester/eventhandlers/portfolio/size/README.md @@ -0,0 +1,48 @@ +# GoCryptoTrader Backtester: Size package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/size) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This size package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Size package overview + +The sizing package ensures that all potential orders raised are within both the CurrencySettings limits as well as the portfolio manager's limits. +- In the event that the order is to large, the sizing package will reduce the order until it fits that limit, inclusive of fees. +- When an order is sized under the limits, an order event cannot be raised an no order will be submitted by the exchange +- The portfolio manager's sizing rules override any CurrencySettings' rules if the sizing is outside the portfolio manager's + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/portfolio/size/size.go b/backtester/eventhandlers/portfolio/size/size.go new file mode 100644 index 00000000..4a7af458 --- /dev/null +++ b/backtester/eventhandlers/portfolio/size/size.go @@ -0,0 +1,116 @@ +package size + +import ( + "fmt" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// SizeOrder is responsible for ensuring that the order size is within config limits +func (s *Size) SizeOrder(o order.Event, amountAvailable float64, cs *exchange.Settings) (*order.Order, error) { + if o == nil || cs == nil { + return nil, common.ErrNilArguments + } + if amountAvailable <= 0 { + return nil, errNoFunds + } + retOrder := o.(*order.Order) + var amount float64 + var err error + switch retOrder.GetDirection() { + case gctorder.Buy: + // check size against currency specific settings + amount, err = s.calculateBuySize(retOrder.Price, amountAvailable, cs.ExchangeFee, cs.BuySide) + if err != nil { + return nil, err + } + // check size against portfolio specific settings + var portfolioSize float64 + portfolioSize, err = s.calculateBuySize(retOrder.Price, amountAvailable, cs.ExchangeFee, s.BuySide) + if err != nil { + return nil, err + } + // global settings overrule individual currency settings + if amount > portfolioSize { + amount = portfolioSize + } + + case gctorder.Sell: + // check size against currency specific settings + amount, err = s.calculateSellSize(retOrder.Price, amountAvailable, cs.ExchangeFee, cs.SellSide) + if err != nil { + return nil, err + } + // check size against portfolio specific settings + portfolioSize, err := s.calculateSellSize(retOrder.Price, amountAvailable, cs.ExchangeFee, s.SellSide) + if err != nil { + return nil, err + } + // global settings overrule individual currency settings + if amount > portfolioSize { + amount = portfolioSize + } + } + if amount <= 0 { + return retOrder, fmt.Errorf("%w at %v for %v %v %v", errCannotAllocate, o.GetTime(), o.GetExchange(), o.GetAssetType(), o.Pair()) + } + retOrder.SetAmount(amount) + + return retOrder, nil +} + +// calculateBuySize respects config rules and calculates the amount of money +// that is allowed to be spent/sold for an event. +// As fee calculation occurs during the actual ordering process +// this can only attempt to factor the potential fee to remain under the max rules +func (s *Size) calculateBuySize(price, availableFunds, feeRate float64, minMaxSettings config.MinMax) (float64, error) { + if availableFunds <= 0 { + return 0, errNoFunds + } + if price == 0 { + return 0, nil + } + amount := availableFunds * (1 - feeRate) / price + if minMaxSettings.MaximumSize > 0 && amount > minMaxSettings.MaximumSize { + amount = minMaxSettings.MaximumSize * (1 - feeRate) + } + if minMaxSettings.MaximumTotal > 0 && (amount+feeRate)*price > minMaxSettings.MaximumTotal { + amount = minMaxSettings.MaximumTotal * (1 - feeRate) / price + } + if amount < minMaxSettings.MinimumSize && minMaxSettings.MinimumSize > 0 { + return 0, fmt.Errorf("%w. Sized: '%.8f' Minimum: '%v'", errLessThanMinimum, amount, minMaxSettings.MinimumSize) + } + + return amount, nil +} + +// calculateSellSize respects config rules and calculates the amount of money +// that is allowed to be spent/sold for an event. +// baseAmount is the base currency quantity that the portfolio currently has that can be sold +// eg BTC-USD baseAmount will be BTC to be sold +// As fee calculation occurs during the actual ordering process +// this can only attempt to factor the potential fee to remain under the max rules +func (s *Size) calculateSellSize(price, baseAmount, feeRate float64, minMaxSettings config.MinMax) (float64, error) { + if baseAmount <= 0 { + return 0, errNoFunds + } + if price == 0 { + return 0, nil + } + amount := baseAmount * (1 - feeRate) + if minMaxSettings.MaximumSize > 0 && amount > minMaxSettings.MaximumSize { + amount = minMaxSettings.MaximumSize * (1 - feeRate) + } + if minMaxSettings.MaximumTotal > 0 && amount*price > minMaxSettings.MaximumTotal { + amount = minMaxSettings.MaximumTotal * (1 - feeRate) / price + } + if amount < minMaxSettings.MinimumSize && minMaxSettings.MinimumSize > 0 { + return 0, fmt.Errorf("%w. Sized: '%.8f' Minimum: '%v'", errLessThanMinimum, amount, minMaxSettings.MinimumSize) + } + + return amount, nil +} diff --git a/backtester/eventhandlers/portfolio/size/size_test.go b/backtester/eventhandlers/portfolio/size/size_test.go new file mode 100644 index 00000000..34e0d7f2 --- /dev/null +++ b/backtester/eventhandlers/portfolio/size/size_test.go @@ -0,0 +1,177 @@ +package size + +import ( + "errors" + "testing" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/exchange" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +func TestSizingAccuracy(t *testing.T) { + t.Parallel() + globalMinMax := config.MinMax{ + MinimumSize: 0, + MaximumSize: 1, + MaximumTotal: 1337, + } + sizer := Size{ + BuySide: globalMinMax, + SellSide: globalMinMax, + } + price := 1338.0 + availableFunds := 1338.0 + feeRate := 0.02 + + amountWithoutFee, err := sizer.calculateBuySize(price, availableFunds, feeRate, globalMinMax) + if err != nil { + t.Error(err) + } + totalWithFee := (price * amountWithoutFee) + (globalMinMax.MaximumTotal * feeRate) + if totalWithFee != globalMinMax.MaximumTotal { + t.Error("incorrect amount calculation") + } +} + +func TestSizingOverMaxSize(t *testing.T) { + t.Parallel() + globalMinMax := config.MinMax{ + MinimumSize: 0, + MaximumSize: 0.5, + MaximumTotal: 1337, + } + sizer := Size{ + BuySide: globalMinMax, + SellSide: globalMinMax, + } + price := 1338.0 + availableFunds := 1338.0 + feeRate := 0.02 + + amount, err := sizer.calculateBuySize(price, availableFunds, feeRate, globalMinMax) + if err != nil { + t.Error(err) + } + if amount > globalMinMax.MaximumSize { + t.Error("greater than max") + } +} + +func TestSizingUnderMinSize(t *testing.T) { + t.Parallel() + globalMinMax := config.MinMax{ + MinimumSize: 1, + MaximumSize: 2, + MaximumTotal: 1337, + } + sizer := Size{ + BuySide: globalMinMax, + SellSide: globalMinMax, + } + price := 1338.0 + availableFunds := 1338.0 + feeRate := 0.02 + + _, err := sizer.calculateBuySize(price, availableFunds, feeRate, globalMinMax) + if !errors.Is(err, errLessThanMinimum) { + t.Errorf("expected: %v, received %v", errLessThanMinimum, err) + } +} + +func TestSizingErrors(t *testing.T) { + t.Parallel() + globalMinMax := config.MinMax{ + MinimumSize: 1, + MaximumSize: 2, + MaximumTotal: 1337, + } + sizer := Size{ + BuySide: globalMinMax, + SellSide: globalMinMax, + } + price := 1338.0 + availableFunds := 0.0 + feeRate := 0.02 + + _, err := sizer.calculateBuySize(price, availableFunds, feeRate, globalMinMax) + if !errors.Is(err, errNoFunds) { + t.Errorf("expected: %v, received %v", errNoFunds, err) + } +} + +func TestCalculateSellSize(t *testing.T) { + t.Parallel() + globalMinMax := config.MinMax{ + MinimumSize: 1, + MaximumSize: 2, + MaximumTotal: 1337, + } + sizer := Size{ + BuySide: globalMinMax, + SellSide: globalMinMax, + } + price := 1338.0 + availableFunds := 0.0 + feeRate := 0.02 + + _, err := sizer.calculateSellSize(price, availableFunds, feeRate, globalMinMax) + if !errors.Is(err, errNoFunds) { + t.Errorf("expected: %v, received %v", errNoFunds, err) + } + availableFunds = 1337 + _, err = sizer.calculateSellSize(price, availableFunds, feeRate, globalMinMax) + if !errors.Is(err, errLessThanMinimum) { + t.Errorf("expected: %v, received %v", errLessThanMinimum, err) + } + price = 12 + availableFunds = 1339 + _, err = sizer.calculateSellSize(price, availableFunds, feeRate, globalMinMax) + if err != nil { + t.Error(err) + } +} + +func TestSizeOrder(t *testing.T) { + t.Parallel() + s := Size{} + _, err := s.SizeOrder(nil, 0, nil) + if !errors.Is(err, common.ErrNilArguments) { + t.Error(err) + } + o := &order.Order{} + cs := &exchange.Settings{} + _, err = s.SizeOrder(o, 0, cs) + if !errors.Is(err, errNoFunds) { + t.Errorf("expected: %v, received %v", errNoFunds, err) + } + + _, err = s.SizeOrder(o, 1337, cs) + if !errors.Is(err, errCannotAllocate) { + t.Errorf("expected: %v, received %v", errCannotAllocate, err) + } + + o.Direction = gctorder.Buy + o.Price = 1 + s.BuySide.MaximumSize = 1 + s.BuySide.MinimumSize = 1 + _, err = s.SizeOrder(o, 1337, cs) + if err != nil { + t.Error(err) + } + + o.Direction = gctorder.Sell + _, err = s.SizeOrder(o, 1337, cs) + if err != nil { + t.Error(err) + } + + s.SellSide.MaximumSize = 1 + s.SellSide.MinimumSize = 1 + _, err = s.SizeOrder(o, 1337, cs) + if err != nil { + t.Error(err) + } +} diff --git a/backtester/eventhandlers/portfolio/size/size_types.go b/backtester/eventhandlers/portfolio/size/size_types.go new file mode 100644 index 00000000..04c2d302 --- /dev/null +++ b/backtester/eventhandlers/portfolio/size/size_types.go @@ -0,0 +1,19 @@ +package size + +import ( + "errors" + + "github.com/thrasher-corp/gocryptotrader/backtester/config" +) + +var ( + errNoFunds = errors.New("no funds available") + errLessThanMinimum = errors.New("sized amount less than minimum") + errCannotAllocate = errors.New("portfolio manager cannot allocate funds for an order") +) + +// Size contains buy and sell side rules +type Size struct { + BuySide config.MinMax + SellSide config.MinMax +} diff --git a/backtester/eventhandlers/statistics/README.md b/backtester/eventhandlers/statistics/README.md new file mode 100644 index 00000000..3c3bc041 --- /dev/null +++ b/backtester/eventhandlers/statistics/README.md @@ -0,0 +1,47 @@ +# GoCryptoTrader Backtester: Statistics package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This statistics package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Statistics package overview + +The statistics package is used for storing all relevant data over the course of a GoCryptoTrader Backtesting run. All types of events are tracked by exchange, asset and currency pair. +When multiple currencies are included in your strategy, the statistics package will be able to calculate which exchange asset currency pair has performed the best, along with the biggest drop downs in the market. + + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/statistics/currencystatistics/README.md b/backtester/eventhandlers/statistics/currencystatistics/README.md new file mode 100644 index 00000000..ef2d80f7 --- /dev/null +++ b/backtester/eventhandlers/statistics/currencystatistics/README.md @@ -0,0 +1,73 @@ +# GoCryptoTrader Backtester: Currencystatistics package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics/currencystatistics) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This currencystatistics package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Currencystatistics package overview + +Currency Statistics is an important package to verify the effectiveness of your strategies. +It can calculate the following: +- Calmar ratio +- Information ratio +- Sharpe ratio +- Sortino ratio +- CAGR +- Drawdowns, both the biggest and longest +- Whether the strategy outperformed the market +- If the strategy made a profit + +## Ratios + +| Ratio | Description | A good range | +| ----- | ----------- | ------------ | +| Calmar ratio | It is a function of the fund's average compounded annual rate of return versus its maximum drawdown. The higher the Calmar ratio, the better it performed on a risk-adjusted basis during the given time frame, which is mostly commonly set at 36 months. | 3.0 to 5.0 | +| Information ratio| It is a measurement of portfolio returns beyond the returns of a benchmark, usually an index, compared to the volatility of those returns. The ratio is often used as a measure of a portfolio manager's level of skill and ability to generate excess returns relative to a benchmark | 0.40-0.60. Any positive number means that it has beaten the benchmark | +| Sharpe ratio | The Sharpe Ratio is a financial metric often used by investors when assessing the performance of investment management products and professionals. It consists of taking the excess return of the portfolio, relative to the risk-free rate, and dividing it by the standard deviation of the portfolio's excess returns | Any Sharpe ratio greater than 1.0 is good. Higher than 2.0 is very good. 3.0 or higher is excellent. Under 1.0 is sub-optimal | +| Sortino ratio | The Sortino ratio measures the risk-adjusted return of an investment asset, portfolio, or strategy. It is a modification of the Sharpe ratio but penalizes only those returns falling below a user-specified target or required rate of return, while the Sharpe ratio penalizes both upside and downside volatility equally. | The higher the better, but > 2 is considered good. | +| Compound annual growth rate | Compound annual growth rate is the rate of return that would be required for an investment to grow from its beginning balance to its ending balance, assuming the profits were reinvested at the end of each year of the investment’s lifespan | Any positive number | + +## Arithmetic or versus geometric? +Both! We calculate ratios where an average is required using both types. The reasoning for using either is debated by finance and mathematicians. [This](https://www.investopedia.com/ask/answers/06/geometricmean.asp) is a good breakdown of both, but here is an extra simple table + +| Average type | A reason to use it | +| ------------ | ------------------ | +| Arithmetic | The arithmetic mean is the average of a sum of numbers, which reflects the central tendency of the position of the numbers | +| Geometric | The geometric mean differs from the arithmetic average, or arithmetic mean, in how it is calculated because it takes into account the compounding that occurs from period to period. Because of this, investors usually consider the geometric mean a more accurate measure of returns than the arithmetic mean. | + + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/statistics/currencystatistics/currencystatistics.go b/backtester/eventhandlers/statistics/currencystatistics/currencystatistics.go new file mode 100644 index 00000000..492925c2 --- /dev/null +++ b/backtester/eventhandlers/statistics/currencystatistics/currencystatistics.go @@ -0,0 +1,332 @@ +package currencystatistics + +import ( + "fmt" + "sort" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + gctcommon "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/common/math" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// CalculateResults calculates all statistics for the exchange, asset, currency pair +func (c *CurrencyStatistic) CalculateResults() error { + var errs gctcommon.Errors + first := c.Events[0] + firstPrice := first.DataEvent.ClosePrice() + last := c.Events[len(c.Events)-1] + lastPrice := last.DataEvent.ClosePrice() + for i := range last.Transactions.Orders { + if last.Transactions.Orders[i].Side == gctorder.Buy { + c.BuyOrders++ + } else if last.Transactions.Orders[i].Side == gctorder.Sell { + c.SellOrders++ + } + } + for i := range c.Events { + price := c.Events[i].DataEvent.ClosePrice() + if c.LowestClosePrice == 0 || price < c.LowestClosePrice { + c.LowestClosePrice = price + } + if price > c.HighestClosePrice { + c.HighestClosePrice = price + } + } + c.MarketMovement = ((lastPrice - firstPrice) / firstPrice) * 100 + c.StrategyMovement = ((last.Holdings.TotalValue - last.Holdings.InitialFunds) / last.Holdings.InitialFunds) * 100 + c.calculateHighestCommittedFunds() + c.RiskFreeRate = last.Holdings.RiskFreeRate * 100 + returnPerCandle := make([]float64, len(c.Events)) + benchmarkRates := make([]float64, len(c.Events)) + + var allDataEvents []common.DataEventHandler + for i := range c.Events { + returnPerCandle[i] = c.Events[i].Holdings.ChangeInTotalValuePercent + allDataEvents = append(allDataEvents, c.Events[i].DataEvent) + if i == 0 { + continue + } + if c.Events[i].SignalEvent != nil && c.Events[i].SignalEvent.GetDirection() == common.MissingData { + c.ShowMissingDataWarning = true + } + benchmarkRates[i] = (c.Events[i].DataEvent.ClosePrice() - c.Events[i-1].DataEvent.ClosePrice()) / c.Events[i-1].DataEvent.ClosePrice() + } + + // remove the first entry as its zero and impacts + // ratio calculations as no movement has been made + benchmarkRates = benchmarkRates[1:] + returnPerCandle = returnPerCandle[1:] + + var arithmeticBenchmarkAverage, geometricBenchmarkAverage float64 + var err error + arithmeticBenchmarkAverage, err = math.ArithmeticMean(benchmarkRates) + if err != nil { + errs = append(errs, err) + } + geometricBenchmarkAverage, err = math.FinancialGeometricMean(benchmarkRates) + if err != nil { + errs = append(errs, err) + } + + c.MaxDrawdown = calculateMaxDrawdown(allDataEvents) + interval := first.DataEvent.GetInterval() + intervalsPerYear := interval.IntervalsPerYear() + + riskFreeRatePerCandle := first.Holdings.RiskFreeRate / intervalsPerYear + riskFreeRateForPeriod := riskFreeRatePerCandle * float64(len(benchmarkRates)) + + var arithmeticReturnsPerCandle, geometricReturnsPerCandle, arithmeticSharpe, arithmeticSortino, + arithmeticInformation, arithmeticCalmar, geomSharpe, geomSortino, geomInformation, geomCalmar float64 + + arithmeticReturnsPerCandle, err = math.ArithmeticMean(returnPerCandle) + if err != nil { + errs = append(errs, err) + } + geometricReturnsPerCandle, err = math.FinancialGeometricMean(returnPerCandle) + if err != nil { + errs = append(errs, err) + } + + arithmeticSharpe, err = math.SharpeRatio(returnPerCandle, riskFreeRatePerCandle, arithmeticReturnsPerCandle) + if err != nil { + errs = append(errs, err) + } + arithmeticSortino, err = math.SortinoRatio(returnPerCandle, riskFreeRatePerCandle, arithmeticReturnsPerCandle) + if err != nil { + errs = append(errs, err) + } + arithmeticInformation, err = math.InformationRatio(returnPerCandle, benchmarkRates, arithmeticReturnsPerCandle, arithmeticBenchmarkAverage) + if err != nil { + errs = append(errs, err) + } + arithmeticCalmar, err = math.CalmarRatio(c.MaxDrawdown.Highest.Price, c.MaxDrawdown.Lowest.Price, arithmeticReturnsPerCandle, riskFreeRateForPeriod) + if err != nil { + errs = append(errs, err) + } + c.ArithmeticRatios = Ratios{ + SharpeRatio: arithmeticSharpe, + SortinoRatio: arithmeticSortino, + InformationRatio: arithmeticInformation, + CalmarRatio: arithmeticCalmar, + } + + geomSharpe, err = math.SharpeRatio(returnPerCandle, riskFreeRatePerCandle, geometricReturnsPerCandle) + if err != nil { + errs = append(errs, err) + } + geomSortino, err = math.SortinoRatio(returnPerCandle, riskFreeRatePerCandle, geometricReturnsPerCandle) + if err != nil { + errs = append(errs, err) + } + geomInformation, err = math.InformationRatio(returnPerCandle, benchmarkRates, geometricReturnsPerCandle, geometricBenchmarkAverage) + if err != nil { + errs = append(errs, err) + } + geomCalmar, err = math.CalmarRatio(c.MaxDrawdown.Highest.Price, c.MaxDrawdown.Lowest.Price, geometricReturnsPerCandle, riskFreeRateForPeriod) + if err != nil { + errs = append(errs, err) + } + c.GeometricRatios = Ratios{ + SharpeRatio: geomSharpe, + SortinoRatio: geomSortino, + InformationRatio: geomInformation, + CalmarRatio: geomCalmar, + } + + c.CompoundAnnualGrowthRate, err = math.CompoundAnnualGrowthRate( + last.Holdings.InitialFunds, + last.Holdings.TotalValue, + intervalsPerYear, + float64(len(c.Events))) + if err != nil { + errs = append(errs, err) + } + if len(errs) > 0 { + return errs + } + return nil +} + +// PrintResults outputs all calculated statistics to the command line +func (c *CurrencyStatistic) PrintResults(e string, a asset.Item, p currency.Pair) { + var errs gctcommon.Errors + sort.Slice(c.Events, func(i, j int) bool { + return c.Events[i].DataEvent.GetTime().Before(c.Events[j].DataEvent.GetTime()) + }) + last := c.Events[len(c.Events)-1] + first := c.Events[0] + c.StartingClosePrice = first.DataEvent.ClosePrice() + c.EndingClosePrice = last.DataEvent.ClosePrice() + c.TotalOrders = c.BuyOrders + c.SellOrders + last.Holdings.TotalValueLost = last.Holdings.TotalValueLostToSlippage + last.Holdings.TotalValueLostToVolumeSizing + currStr := fmt.Sprintf("------------------Stats for %v %v %v------------------------------------------", e, a, p) + + log.Infof(log.BackTester, currStr[:61]) + log.Infof(log.BackTester, "Initial funds: $%.2f", last.Holdings.InitialFunds) + log.Infof(log.BackTester, "Highest committed funds: $%.2f at %v\n\n", c.HighestCommittedFunds.Value, c.HighestCommittedFunds.Time) + + log.Infof(log.BackTester, "Buy orders: %d", c.BuyOrders) + log.Infof(log.BackTester, "Buy value: $%.2f", last.Holdings.BoughtValue) + log.Infof(log.BackTester, "Buy amount: %.2f %v", last.Holdings.BoughtAmount, last.Holdings.Pair.Base) + log.Infof(log.BackTester, "Sell orders: %d", c.SellOrders) + log.Infof(log.BackTester, "Sell value: $%.2f", last.Holdings.SoldValue) + log.Infof(log.BackTester, "Sell amount: %.2f %v", last.Holdings.SoldAmount, last.Holdings.Pair.Base) + log.Infof(log.BackTester, "Total orders: %d\n\n", c.TotalOrders) + + log.Info(log.BackTester, "------------------Max Drawdown-------------------------------") + log.Infof(log.BackTester, "Highest Price of drawdown: $%.2f", c.MaxDrawdown.Highest.Price) + log.Infof(log.BackTester, "Time of highest price of drawdown: %v", c.MaxDrawdown.Highest.Time) + log.Infof(log.BackTester, "Lowest Price of drawdown: $%.2f", c.MaxDrawdown.Lowest.Price) + log.Infof(log.BackTester, "Time of lowest price of drawdown: %v", c.MaxDrawdown.Lowest.Time) + log.Infof(log.BackTester, "Calculated Drawdown: %.2f%%", c.MaxDrawdown.DrawdownPercent) + log.Infof(log.BackTester, "Difference: $%.2f", c.MaxDrawdown.Highest.Price-c.MaxDrawdown.Lowest.Price) + log.Infof(log.BackTester, "Drawdown length: %d\n\n", c.MaxDrawdown.IntervalDuration) + + log.Info(log.BackTester, "------------------Rates-------------------------------------------------") + log.Infof(log.BackTester, "Risk free rate: %.3f%%", c.RiskFreeRate) + log.Infof(log.BackTester, "Compound Annual Growth Rate: %.2f\n\n", c.CompoundAnnualGrowthRate) + + log.Info(log.BackTester, "------------------Arithmetic Ratios-------------------------------------") + if c.ShowMissingDataWarning { + log.Infoln(log.BackTester, "Missing data was detected during this backtesting run") + log.Infoln(log.BackTester, "Ratio calculations will be skewed") + } + log.Infof(log.BackTester, "Sharpe ratio: %.2f", c.ArithmeticRatios.SharpeRatio) + log.Infof(log.BackTester, "Sortino ratio: %.2f", c.ArithmeticRatios.SortinoRatio) + log.Infof(log.BackTester, "Information ratio: %.2f", c.ArithmeticRatios.InformationRatio) + log.Infof(log.BackTester, "Calmar ratio: %.2f\n\n", c.ArithmeticRatios.CalmarRatio) + + log.Info(log.BackTester, "------------------Geometric Ratios-------------------------------------") + if c.ShowMissingDataWarning { + log.Infoln(log.BackTester, "Missing data was detected during this backtesting run") + log.Infoln(log.BackTester, "Ratio calculations will be skewed") + } + log.Infof(log.BackTester, "Sharpe ratio: %.2f", c.GeometricRatios.SharpeRatio) + log.Infof(log.BackTester, "Sortino ratio: %.2f", c.GeometricRatios.SortinoRatio) + log.Infof(log.BackTester, "Information ratio: %.2f", c.GeometricRatios.InformationRatio) + log.Infof(log.BackTester, "Calmar ratio: %.2f\n\n", c.GeometricRatios.CalmarRatio) + + log.Info(log.BackTester, "------------------Results------------------------------------") + log.Infof(log.BackTester, "Starting Close Price: $%.2f", c.StartingClosePrice) + log.Infof(log.BackTester, "Finishing Close Price: $%.2f", c.EndingClosePrice) + log.Infof(log.BackTester, "Lowest Close Price: $%.2f", c.LowestClosePrice) + log.Infof(log.BackTester, "Highest Close Price: $%.2f", c.HighestClosePrice) + + log.Infof(log.BackTester, "Market movement: %.4f%%", c.MarketMovement) + log.Infof(log.BackTester, "Strategy movement: %.4f%%", c.StrategyMovement) + log.Infof(log.BackTester, "Did it beat the market: %v", c.StrategyMovement > c.MarketMovement) + + log.Infof(log.BackTester, "Value lost to volume sizing: $%.2f", last.Holdings.TotalValueLostToVolumeSizing) + log.Infof(log.BackTester, "Value lost to slippage: $%.2f", last.Holdings.TotalValueLostToSlippage) + log.Infof(log.BackTester, "Total Value lost: $%.2f", last.Holdings.TotalValueLost) + log.Infof(log.BackTester, "Total Fees: $%.2f\n\n", last.Holdings.TotalFees) + + log.Infof(log.BackTester, "Final funds: $%.2f", last.Holdings.RemainingFunds) + log.Infof(log.BackTester, "Final holdings: %.2f", last.Holdings.PositionsSize) + log.Infof(log.BackTester, "Final holdings value: $%.2f", last.Holdings.PositionsValue) + log.Infof(log.BackTester, "Final total value: $%.2f\n\n", last.Holdings.TotalValue) + + if len(errs) > 0 { + log.Info(log.BackTester, "------------------Errors-------------------------------------") + for i := range errs { + log.Info(log.BackTester, errs[i].Error()) + } + } +} + +func calculateMaxDrawdown(closePrices []common.DataEventHandler) Swing { + var lowestPrice, highestPrice float64 + var lowestTime, highestTime time.Time + var swings []Swing + if len(closePrices) > 0 { + lowestPrice = closePrices[0].LowPrice() + highestPrice = closePrices[0].HighPrice() + lowestTime = closePrices[0].GetTime() + highestTime = closePrices[0].GetTime() + } + for i := range closePrices { + currHigh := closePrices[i].HighPrice() + currLow := closePrices[i].LowPrice() + currTime := closePrices[i].GetTime() + if lowestPrice > currLow && currLow != 0 { + lowestPrice = currLow + lowestTime = currTime + } + if highestPrice < currHigh && highestPrice > 0 { + intervals := gctkline.CalculateCandleDateRanges(highestTime, lowestTime, closePrices[i].GetInterval(), 0) + if lowestTime.Equal(highestTime) { + // create distinction if the greatest drawdown occurs within the same candle + lowestTime = lowestTime.Add((time.Hour * 23) + (time.Minute * 59) + (time.Second * 59)) + } + swings = append(swings, Swing{ + Highest: Iteration{ + Time: highestTime, + Price: highestPrice, + }, + Lowest: Iteration{ + Time: lowestTime, + Price: lowestPrice, + }, + DrawdownPercent: ((lowestPrice - highestPrice) / highestPrice) * 100, + IntervalDuration: int64(len(intervals.Ranges[0].Intervals)), + }) + // reset the drawdown + highestPrice = currHigh + highestTime = currTime + lowestPrice = currLow + lowestTime = currTime + } + } + if (len(swings) > 0 && swings[len(swings)-1].Lowest.Price != closePrices[len(closePrices)-1].LowPrice()) || swings == nil { + // need to close out the final drawdown + intervals := gctkline.CalculateCandleDateRanges(highestTime, lowestTime, closePrices[0].GetInterval(), 0) + drawdownPercent := 0.0 + if highestPrice > 0 { + drawdownPercent = ((lowestPrice - highestPrice) / highestPrice) * 100 + } + if lowestTime.Equal(highestTime) { + // create distinction if the greatest drawdown occurs within the same candle + lowestTime = lowestTime.Add((time.Hour * 23) + (time.Minute * 59) + (time.Second * 59)) + } + swings = append(swings, Swing{ + Highest: Iteration{ + Time: highestTime, + Price: highestPrice, + }, + Lowest: Iteration{ + Time: lowestTime, + Price: lowestPrice, + }, + DrawdownPercent: drawdownPercent, + IntervalDuration: int64(len(intervals.Ranges[0].Intervals)), + }) + } + + var maxDrawdown Swing + if len(swings) > 0 { + maxDrawdown = swings[0] + } + for i := range swings { + if swings[i].DrawdownPercent < maxDrawdown.DrawdownPercent { + // drawdowns are negative + maxDrawdown = swings[i] + } + } + + return maxDrawdown +} + +func (c *CurrencyStatistic) calculateHighestCommittedFunds() { + for i := range c.Events { + if c.Events[i].Holdings.CommittedFunds > c.HighestCommittedFunds.Value { + c.HighestCommittedFunds.Value = c.Events[i].Holdings.CommittedFunds + c.HighestCommittedFunds.Time = c.Events[i].Holdings.Timestamp + } + } +} diff --git a/backtester/eventhandlers/statistics/currencystatistics/currencystatistics_test.go b/backtester/eventhandlers/statistics/currencystatistics/currencystatistics_test.go new file mode 100644 index 00000000..b3eb6316 --- /dev/null +++ b/backtester/eventhandlers/statistics/currencystatistics/currencystatistics_test.go @@ -0,0 +1,323 @@ +package currencystatistics + +import ( + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const testExchange = "binance" + +func TestCalculateResults(t *testing.T) { + cs := CurrencyStatistic{} + tt1 := time.Now() + tt2 := time.Now().Add(gctkline.OneDay.Duration()) + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + even := event.Base{ + Exchange: exch, + Time: tt1, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + } + ev := EventStore{ + Holdings: holdings.Holding{ + ChangeInTotalValuePercent: 0.1333, + Timestamp: tt1, + InitialFunds: 1337, + }, + Transactions: compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + ClosePrice: 1338, + VolumeAdjustedPrice: 1338, + SlippageRate: 1338, + CostBasis: 1338, + Detail: &order.Detail{Side: order.Buy}, + }, + { + ClosePrice: 1337, + VolumeAdjustedPrice: 1337, + SlippageRate: 1337, + CostBasis: 1337, + Detail: &order.Detail{Side: order.Sell}, + }, + }, + }, + DataEvent: &kline.Kline{ + Base: even, + Open: 2000, + Close: 2000, + Low: 2000, + High: 2000, + Volume: 2000, + }, + SignalEvent: &signal.Signal{ + Base: even, + ClosePrice: 2000, + }, + } + even2 := even + even2.Time = tt2 + ev2 := EventStore{ + Holdings: holdings.Holding{ + ChangeInTotalValuePercent: 0.1337, + Timestamp: tt2, + InitialFunds: 1337, + }, + Transactions: compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + ClosePrice: 1338, + VolumeAdjustedPrice: 1338, + SlippageRate: 1338, + CostBasis: 1338, + Detail: &order.Detail{Side: order.Buy}, + }, + { + ClosePrice: 1337, + VolumeAdjustedPrice: 1337, + SlippageRate: 1337, + CostBasis: 1337, + Detail: &order.Detail{Side: order.Sell}, + }, + }, + }, + DataEvent: &kline.Kline{ + Base: even2, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }, + SignalEvent: &signal.Signal{ + Base: even2, + ClosePrice: 1337, + }, + } + + cs.Events = append(cs.Events, ev, ev2) + err := cs.CalculateResults() + if err != nil { + t.Error(err) + } + if cs.MarketMovement != -33.15 { + t.Error("expected -33.15") + } +} + +func TestPrintResults(t *testing.T) { + cs := CurrencyStatistic{} + tt1 := time.Now() + tt2 := time.Now().Add(gctkline.OneDay.Duration()) + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + even := event.Base{ + Exchange: exch, + Time: tt1, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + } + ev := EventStore{ + Holdings: holdings.Holding{ + ChangeInTotalValuePercent: 0.1333, + Timestamp: tt1, + InitialFunds: 1337, + }, + Transactions: compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + ClosePrice: 1338, + VolumeAdjustedPrice: 1338, + SlippageRate: 1338, + CostBasis: 1338, + Detail: &order.Detail{Side: order.Buy}, + }, + { + ClosePrice: 1337, + VolumeAdjustedPrice: 1337, + SlippageRate: 1337, + CostBasis: 1337, + Detail: &order.Detail{Side: order.Sell}, + }, + }, + }, + DataEvent: &kline.Kline{ + Base: even, + Open: 2000, + Close: 2000, + Low: 2000, + High: 2000, + Volume: 2000, + }, + SignalEvent: &signal.Signal{ + Base: even, + ClosePrice: 2000, + }, + } + even2 := even + even2.Time = tt2 + ev2 := EventStore{ + Holdings: holdings.Holding{ + ChangeInTotalValuePercent: 0.1337, + Timestamp: tt2, + InitialFunds: 1337, + }, + Transactions: compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + ClosePrice: 1338, + VolumeAdjustedPrice: 1338, + SlippageRate: 1338, + CostBasis: 1338, + Detail: &order.Detail{Side: order.Buy}, + }, + { + ClosePrice: 1337, + VolumeAdjustedPrice: 1337, + SlippageRate: 1337, + CostBasis: 1337, + Detail: &order.Detail{Side: order.Sell}, + }, + }, + }, + DataEvent: &kline.Kline{ + Base: even2, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }, + SignalEvent: &signal.Signal{ + Base: even2, + ClosePrice: 1337, + }, + } + + cs.Events = append(cs.Events, ev, ev2) + err := cs.CalculateResults() + if err != nil { + t.Error(err) + } + cs.PrintResults(exch, a, p) +} + +func TestCalculateMaxDrawdown(t *testing.T) { + tt1 := time.Now().Round(gctkline.OneDay.Duration()) + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + var events []common.DataEventHandler + for i := 0; i < 100; i++ { + tt1 = tt1.Add(gctkline.OneDay.Duration()) + even := event.Base{ + Exchange: exch, + Time: tt1, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + } + if i == 50 { + // throw in a wrench, a spike in price + events = append(events, &kline.Kline{ + Base: even, + Close: 1336, + High: 1336, + Low: 1336, + }) + } else { + events = append(events, &kline.Kline{ + Base: even, + Close: 1337 - float64(i), + High: 1337 - float64(i), + Low: 1337 - float64(i), + }) + } + } + + tt1 = tt1.Add(gctkline.OneDay.Duration()) + even := event.Base{ + Exchange: exch, + Time: tt1, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + } + events = append(events, &kline.Kline{ + Base: even, + Close: 1338, + High: 1338, + Low: 1338, + }) + + tt1 = tt1.Add(gctkline.OneDay.Duration()) + even = event.Base{ + Exchange: exch, + Time: tt1, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + } + events = append(events, &kline.Kline{ + Base: even, + Close: 1337, + High: 1337, + Low: 1337, + }) + + tt1 = tt1.Add(gctkline.OneDay.Duration()) + even = event.Base{ + Exchange: exch, + Time: tt1, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + } + events = append(events, &kline.Kline{ + Base: even, + Close: 1339, + High: 1339, + Low: 1339, + }) + + resp := calculateMaxDrawdown(events) + if resp.Highest.Price != 1337 && resp.Lowest.Price != 1238 { + t.Error("unexpected max drawdown") + } +} + +func TestCalculateHighestCommittedFunds(t *testing.T) { + c := CurrencyStatistic{} + c.calculateHighestCommittedFunds() + if !c.HighestCommittedFunds.Time.IsZero() { + t.Error("expected no time with not committed funds") + } + tt1 := time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC) + tt2 := time.Date(2021, 2, 1, 0, 0, 0, 0, time.UTC) + tt3 := time.Date(2021, 3, 1, 0, 0, 0, 0, time.UTC) + c.Events = append(c.Events, + EventStore{Holdings: holdings.Holding{Timestamp: tt1, CommittedFunds: 10}}, + EventStore{Holdings: holdings.Holding{Timestamp: tt2, CommittedFunds: 1337}}, + EventStore{Holdings: holdings.Holding{Timestamp: tt3, CommittedFunds: 11}}, + ) + c.calculateHighestCommittedFunds() + if c.HighestCommittedFunds.Time != tt2 { + t.Errorf("expected %v, received %v", tt2, c.HighestCommittedFunds.Time) + } +} diff --git a/backtester/eventhandlers/statistics/currencystatistics/currencystatistics_types.go b/backtester/eventhandlers/statistics/currencystatistics/currencystatistics_types.go new file mode 100644 index 00000000..03beb4fd --- /dev/null +++ b/backtester/eventhandlers/statistics/currencystatistics/currencystatistics_types.go @@ -0,0 +1,84 @@ +package currencystatistics + +import ( + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" +) + +// CurrencyStats defines what is expected in order to +// calculate statistics based on an exchange, asset type and currency pair +type CurrencyStats interface { + TotalEquityReturn() (float64, error) + MaxDrawdown() Swing + LongestDrawdown() Swing + SharpeRatio(float64) float64 + SortinoRatio(float64) float64 +} + +// EventStore is used to hold all event information +// at a time interval +type EventStore struct { + Holdings holdings.Holding + Transactions compliance.Snapshot + DataEvent common.DataEventHandler + SignalEvent signal.Event + OrderEvent order.Event + FillEvent fill.Event +} + +// CurrencyStatistic Holds all events and statistics relevant to an exchange, asset type and currency pair +type CurrencyStatistic struct { + Events []EventStore `json:"-"` + MaxDrawdown Swing `json:"max-drawdown,omitempty"` + StartingClosePrice float64 `json:"starting-close-price"` + EndingClosePrice float64 `json:"ending-close-price"` + LowestClosePrice float64 `json:"lowest-close-price"` + HighestClosePrice float64 `json:"highest-close-price"` + MarketMovement float64 `json:"market-movement"` + StrategyMovement float64 `json:"strategy-movement"` + HighestCommittedFunds HighestCommittedFunds `json:"highest-committed-funds"` + RiskFreeRate float64 `json:"risk-free-rate"` + BuyOrders int64 `json:"buy-orders"` + GeometricRatios Ratios `json:"geometric-ratios"` + ArithmeticRatios Ratios `json:"arithmetic-ratios"` + CompoundAnnualGrowthRate float64 `json:"compound-annual-growth-rate"` + SellOrders int64 `json:"sell-orders"` + TotalOrders int64 `json:"total-orders"` + FinalHoldings holdings.Holding `json:"final-holdings"` + FinalOrders compliance.Snapshot `json:"final-orders"` + ShowMissingDataWarning bool `json:"-"` +} + +// Ratios stores all the ratios used for statistics +type Ratios struct { + SharpeRatio float64 `json:"sharpe-ratio"` + SortinoRatio float64 `json:"sortino-ratio"` + InformationRatio float64 `json:"information-ratio"` + CalmarRatio float64 `json:"calmar-ratio"` +} + +// Swing holds a drawdown +type Swing struct { + Highest Iteration `json:"highest"` + Lowest Iteration `json:"lowest"` + DrawdownPercent float64 `json:"drawdown"` + IntervalDuration int64 +} + +// Iteration is an individual iteration of price at a time +type Iteration struct { + Time time.Time `json:"time"` + Price float64 `json:"price"` +} + +// HighestCommittedFunds is an individual iteration of price at a time +type HighestCommittedFunds struct { + Time time.Time `json:"time"` + Value float64 `json:"value"` +} diff --git a/backtester/eventhandlers/statistics/statistics.go b/backtester/eventhandlers/statistics/statistics.go new file mode 100644 index 00000000..4e1ffad4 --- /dev/null +++ b/backtester/eventhandlers/statistics/statistics.go @@ -0,0 +1,329 @@ +package statistics + +import ( + "encoding/json" + "fmt" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics/currencystatistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + gctcommon "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// Reset returns the struct to defaults +func (s *Statistic) Reset() { + *s = Statistic{} +} + +// SetupEventForTime sets up the big map for to store important data at each time interval +func (s *Statistic) SetupEventForTime(e common.DataEventHandler) error { + if e == nil { + return common.ErrNilEvent + } + ex := e.GetExchange() + a := e.GetAssetType() + p := e.Pair() + s.setupMap(ex, a) + lookup := s.ExchangeAssetPairStatistics[ex][a][p] + if lookup == nil { + lookup = ¤cystatistics.CurrencyStatistic{} + } + lookup.Events = append(lookup.Events, + currencystatistics.EventStore{ + DataEvent: e, + }, + ) + s.ExchangeAssetPairStatistics[ex][a][p] = lookup + + return nil +} + +func (s *Statistic) setupMap(ex string, a asset.Item) { + if s.ExchangeAssetPairStatistics == nil { + s.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + } + if s.ExchangeAssetPairStatistics[ex] == nil { + s.ExchangeAssetPairStatistics[ex] = make(map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + } + if s.ExchangeAssetPairStatistics[ex][a] == nil { + s.ExchangeAssetPairStatistics[ex][a] = make(map[currency.Pair]*currencystatistics.CurrencyStatistic) + } +} + +// SetEventForOffset sets the event for the time period in the event +func (s *Statistic) SetEventForOffset(e common.EventHandler) error { + if e == nil { + return common.ErrNilEvent + } + if s.ExchangeAssetPairStatistics == nil { + return errExchangeAssetPairStatsUnset + } + exch := e.GetExchange() + a := e.GetAssetType() + p := e.Pair() + offset := e.GetOffset() + lookup := s.ExchangeAssetPairStatistics[exch][a][p] + if lookup == nil { + return fmt.Errorf("%w for %v %v %v to set signal event", errCurrencyStatisticsUnset, exch, a, p) + } + for i := len(lookup.Events) - 1; i >= 0; i-- { + if lookup.Events[i].DataEvent.GetOffset() == offset { + return applyEventAtOffset(e, lookup, i) + } + } + + return nil +} + +func applyEventAtOffset(e common.EventHandler, lookup *currencystatistics.CurrencyStatistic, i int) error { + switch t := e.(type) { + case common.DataEventHandler: + lookup.Events[i].DataEvent = t + case signal.Event: + lookup.Events[i].SignalEvent = t + case order.Event: + lookup.Events[i].OrderEvent = t + case fill.Event: + lookup.Events[i].FillEvent = t + default: + return fmt.Errorf("unknown event type received: %v", e) + } + return nil +} + +// AddHoldingsForTime adds all holdings to the statistics at the time period +func (s *Statistic) AddHoldingsForTime(h *holdings.Holding) error { + if s.ExchangeAssetPairStatistics == nil { + return errExchangeAssetPairStatsUnset + } + lookup := s.ExchangeAssetPairStatistics[h.Exchange][h.Asset][h.Pair] + if lookup == nil { + return fmt.Errorf("%w for %v %v %v to set holding event", errCurrencyStatisticsUnset, h.Exchange, h.Asset, h.Pair) + } + for i := len(lookup.Events) - 1; i >= 0; i-- { + if lookup.Events[i].DataEvent.GetOffset() == h.Offset { + lookup.Events[i].Holdings = *h + break + } + } + return nil +} + +// AddComplianceSnapshotForTime adds the compliance snapshot to the statistics at the time period +func (s *Statistic) AddComplianceSnapshotForTime(c compliance.Snapshot, e fill.Event) error { + if e == nil { + return common.ErrNilEvent + } + if s.ExchangeAssetPairStatistics == nil { + return errExchangeAssetPairStatsUnset + } + exch := e.GetExchange() + a := e.GetAssetType() + p := e.Pair() + lookup := s.ExchangeAssetPairStatistics[exch][a][p] + if lookup == nil { + return fmt.Errorf("%w for %v %v %v to set compliance snapshot", errCurrencyStatisticsUnset, exch, a, p) + } + for i := len(lookup.Events) - 1; i >= 0; i-- { + if lookup.Events[i].DataEvent.GetOffset() == e.GetOffset() { + lookup.Events[i].Transactions = c + break + } + } + + return nil +} + +// CalculateAllResults calculates the statistics of all exchange asset pair holdings, +// orders, ratios and drawdowns +func (s *Statistic) CalculateAllResults() error { + log.Info(log.BackTester, "calculating backtesting results") + s.PrintAllEvents() + currCount := 0 + var finalResults []FinalResultsHolder + for exchangeName, exchangeMap := range s.ExchangeAssetPairStatistics { + for assetItem, assetMap := range exchangeMap { + for pair, stats := range assetMap { + currCount++ + err := stats.CalculateResults() + if err != nil { + return err + } + stats.PrintResults(exchangeName, assetItem, pair) + last := stats.Events[len(stats.Events)-1] + stats.FinalHoldings = last.Holdings + stats.FinalOrders = last.Transactions + s.AllStats = append(s.AllStats, *stats) + + finalResults = append(finalResults, FinalResultsHolder{ + Exchange: exchangeName, + Asset: assetItem, + Pair: pair, + MaxDrawdown: stats.MaxDrawdown, + MarketMovement: stats.MarketMovement, + StrategyMovement: stats.StrategyMovement, + }) + s.TotalBuyOrders += stats.BuyOrders + s.TotalSellOrders += stats.SellOrders + if stats.ShowMissingDataWarning { + s.WasAnyDataMissing = true + } + } + } + } + s.TotalOrders = s.TotalBuyOrders + s.TotalSellOrders + if currCount > 1 { + s.BiggestDrawdown = s.GetTheBiggestDrawdownAcrossCurrencies(finalResults) + s.BestMarketMovement = s.GetBestMarketPerformer(finalResults) + s.BestStrategyResults = s.GetBestStrategyPerformer(finalResults) + s.PrintTotalResults() + } + + return nil +} + +// PrintTotalResults outputs all results to the CMD +func (s *Statistic) PrintTotalResults() { + log.Info(log.BackTester, "------------------Strategy-----------------------------------") + log.Infof(log.BackTester, "Strategy Name: %v", s.StrategyName) + log.Infof(log.BackTester, "Strategy Nickname: %v", s.StrategyNickname) + log.Infof(log.BackTester, "Strategy Goal: %v\n\n", s.StrategyGoal) + log.Info(log.BackTester, "------------------Total Results------------------------------") + log.Info(log.BackTester, "------------------Orders----------------------------------") + log.Infof(log.BackTester, "Total buy orders: %v", s.TotalBuyOrders) + log.Infof(log.BackTester, "Total sell orders: %v", s.TotalSellOrders) + log.Infof(log.BackTester, "Total orders: %v\n\n", s.TotalOrders) + + if s.BiggestDrawdown != nil { + log.Info(log.BackTester, "------------------Biggest Drawdown------------------------") + log.Infof(log.BackTester, "Exchange: %v Asset: %v Currency: %v", s.BiggestDrawdown.Exchange, s.BiggestDrawdown.Asset, s.BiggestDrawdown.Pair) + log.Infof(log.BackTester, "Highest Price: $%.2f", s.BiggestDrawdown.MaxDrawdown.Highest.Price) + log.Infof(log.BackTester, "Highest Price Time: %v", s.BiggestDrawdown.MaxDrawdown.Highest.Time) + log.Infof(log.BackTester, "Lowest Price: $%v", s.BiggestDrawdown.MaxDrawdown.Lowest.Price) + log.Infof(log.BackTester, "Lowest Price Time: %v", s.BiggestDrawdown.MaxDrawdown.Lowest.Time) + log.Infof(log.BackTester, "Calculated Drawdown: %.2f%%", s.BiggestDrawdown.MaxDrawdown.DrawdownPercent) + log.Infof(log.BackTester, "Difference: $%.2f", s.BiggestDrawdown.MaxDrawdown.Highest.Price-s.BiggestDrawdown.MaxDrawdown.Lowest.Price) + log.Infof(log.BackTester, "Drawdown length: %v\n\n", s.BiggestDrawdown.MaxDrawdown.IntervalDuration) + } + if s.BestMarketMovement != nil && s.BestStrategyResults != nil { + log.Info(log.BackTester, "------------------Orders----------------------------------") + log.Infof(log.BackTester, "Best performing market movement: %v %v %v %v%%", s.BestMarketMovement.Exchange, s.BestMarketMovement.Asset, s.BestMarketMovement.Pair, s.BestMarketMovement.MarketMovement) + log.Infof(log.BackTester, "Best performing strategy movement: %v %v %v %v%%\n\n", s.BestStrategyResults.Exchange, s.BestStrategyResults.Asset, s.BestStrategyResults.Pair, s.BestStrategyResults.StrategyMovement) + } +} + +// GetBestMarketPerformer returns the best final market movement +func (s *Statistic) GetBestMarketPerformer(results []FinalResultsHolder) *FinalResultsHolder { + result := &FinalResultsHolder{} + for i := range results { + if results[i].MarketMovement > result.MarketMovement || result.MarketMovement == 0 { + result = &results[i] + break + } + } + + return result +} + +// GetBestStrategyPerformer returns the best performing strategy result +func (s *Statistic) GetBestStrategyPerformer(results []FinalResultsHolder) *FinalResultsHolder { + result := &FinalResultsHolder{} + for i := range results { + if results[i].StrategyMovement > result.StrategyMovement || result.StrategyMovement == 0 { + result = &results[i] + } + } + + return result +} + +// GetTheBiggestDrawdownAcrossCurrencies returns the biggest drawdown across all currencies in a backtesting run +func (s *Statistic) GetTheBiggestDrawdownAcrossCurrencies(results []FinalResultsHolder) *FinalResultsHolder { + result := &FinalResultsHolder{} + for i := range results { + if results[i].MaxDrawdown.DrawdownPercent > result.MaxDrawdown.DrawdownPercent || result.MaxDrawdown.DrawdownPercent == 0 { + result = &results[i] + } + } + + return result +} + +// PrintAllEvents outputs all event details in the CMD +func (s *Statistic) PrintAllEvents() { + log.Info(log.BackTester, "------------------Events-------------------------------------") + var errs gctcommon.Errors + for e, x := range s.ExchangeAssetPairStatistics { + for a, y := range x { + for p, c := range y { + for i := range c.Events { + switch { + case c.Events[i].FillEvent != nil: + direction := c.Events[i].FillEvent.GetDirection() + if direction == common.CouldNotBuy || + direction == common.CouldNotSell || + direction == common.DoNothing || + direction == common.MissingData || + direction == "" { + log.Infof(log.BackTester, "%v | Price: $%v - Direction: %v - Reason: %s", + c.Events[i].FillEvent.GetTime().Format(gctcommon.SimpleTimeFormat), + c.Events[i].FillEvent.GetClosePrice(), + c.Events[i].FillEvent.GetDirection(), + c.Events[i].FillEvent.GetReason()) + } else { + log.Infof(log.BackTester, "%v | Price: $%v - Amount: %v - Fee: $%v - Total: $%v - Direction %v - Reason: %s", + c.Events[i].FillEvent.GetTime().Format(gctcommon.SimpleTimeFormat), + c.Events[i].FillEvent.GetPurchasePrice(), + c.Events[i].FillEvent.GetAmount(), + c.Events[i].FillEvent.GetExchangeFee(), + c.Events[i].FillEvent.GetTotal(), + c.Events[i].FillEvent.GetDirection(), + c.Events[i].FillEvent.GetReason(), + ) + } + case c.Events[i].SignalEvent != nil: + log.Infof(log.BackTester, "%v | Price: $%v - Reason: %v", + c.Events[i].SignalEvent.GetTime().Format(gctcommon.SimpleTimeFormat), + c.Events[i].SignalEvent.GetPrice(), + c.Events[i].SignalEvent.GetReason()) + case c.Events[i].DataEvent != nil: + log.Infof(log.BackTester, "%v | Price: $%v - Reason: %v", + c.Events[i].DataEvent.GetTime().Format(gctcommon.SimpleTimeFormat), + c.Events[i].DataEvent.ClosePrice(), + c.Events[i].DataEvent.GetReason()) + default: + errs = append(errs, fmt.Errorf("%v %v %v unexpected data received %+v", e, a, p, c.Events[i])) + } + } + } + } + } + if len(errs) > 0 { + log.Info(log.BackTester, "------------------Errors-------------------------------------") + for i := range errs { + log.Info(log.BackTester, errs[i].Error()) + } + } +} + +// SetStrategyName sets the name for statistical identification +func (s *Statistic) SetStrategyName(name string) { + s.StrategyName = name +} + +// Serialise outputs the Statistic struct in json +func (s *Statistic) Serialise() (string, error) { + resp, err := json.MarshalIndent(s, "", " ") + if err != nil { + return "", err + } + + return string(resp), nil +} diff --git a/backtester/eventhandlers/statistics/statistics_test.go b/backtester/eventhandlers/statistics/statistics_test.go new file mode 100644 index 00000000..253c0ae2 --- /dev/null +++ b/backtester/eventhandlers/statistics/statistics_test.go @@ -0,0 +1,721 @@ +package statistics + +import ( + "errors" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics/currencystatistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const testExchange = "binance" + +func TestReset(t *testing.T) { + s := Statistic{ + TotalOrders: 1, + } + s.Reset() + if s.TotalOrders != 0 { + t.Error("expected 0") + } +} + +func TestAddDataEventForTime(t *testing.T) { + tt := time.Now() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + s := Statistic{} + err := s.SetupEventForTime(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + if s.ExchangeAssetPairStatistics == nil { + t.Error("expected not nil") + } + if len(s.ExchangeAssetPairStatistics[exch][a][p].Events) != 1 { + t.Error("expected 1 event") + } +} + +func TestAddSignalEventForTime(t *testing.T) { + tt := time.Now() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + s := Statistic{} + err := s.SetEventForOffset(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + err = s.SetEventForOffset(&signal.Signal{}) + if !errors.Is(err, errExchangeAssetPairStatsUnset) { + t.Errorf("expected: %v, received %v", errExchangeAssetPairStatsUnset, err) + } + s.setupMap(exch, a) + s.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + err = s.SetEventForOffset(&signal.Signal{}) + if !errors.Is(err, errCurrencyStatisticsUnset) { + t.Errorf("expected: %v, received %v", errCurrencyStatisticsUnset, err) + } + + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + err = s.SetEventForOffset(&signal.Signal{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + ClosePrice: 1337, + Direction: gctorder.Buy, + }) + if err != nil { + t.Error(err) + } +} + +func TestAddExchangeEventForTime(t *testing.T) { + tt := time.Now() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + s := Statistic{} + err := s.SetEventForOffset(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + err = s.SetEventForOffset(&order.Order{}) + if !errors.Is(err, errExchangeAssetPairStatsUnset) { + t.Errorf("expected: %v, received %v", errExchangeAssetPairStatsUnset, err) + } + s.setupMap(exch, a) + s.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + err = s.SetEventForOffset(&order.Order{}) + if !errors.Is(err, errCurrencyStatisticsUnset) { + t.Errorf("expected: %v, received %v", errCurrencyStatisticsUnset, err) + } + + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + err = s.SetEventForOffset(&order.Order{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + ID: "1337", + Direction: gctorder.Buy, + Status: gctorder.New, + Price: 1337, + Amount: 1337, + OrderType: gctorder.Stop, + Leverage: 1337, + }) + if err != nil { + t.Error(err) + } +} + +func TestAddFillEventForTime(t *testing.T) { + tt := time.Now() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + s := Statistic{} + err := s.SetEventForOffset(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + err = s.SetEventForOffset(&fill.Fill{}) + if err != nil && err.Error() != "exchangeAssetPairStatistics not setup" { + t.Error(err) + } + s.setupMap(exch, a) + s.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + err = s.SetEventForOffset(&fill.Fill{}) + if !errors.Is(err, errCurrencyStatisticsUnset) { + t.Errorf("expected: %v, received %v", errCurrencyStatisticsUnset, err) + } + + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + err = s.SetEventForOffset(&fill.Fill{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Direction: gctorder.Buy, + Amount: 1337, + ClosePrice: 1337, + VolumeAdjustedPrice: 1337, + PurchasePrice: 1337, + ExchangeFee: 1337, + Slippage: 1337, + }) + if err != nil { + t.Error(err) + } +} + +func TestAddHoldingsForTime(t *testing.T) { + tt := time.Now() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + s := Statistic{} + err := s.AddHoldingsForTime(&holdings.Holding{}) + if !errors.Is(err, errExchangeAssetPairStatsUnset) { + t.Errorf("expected: %v, received %v", errExchangeAssetPairStatsUnset, err) + } + s.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + err = s.AddHoldingsForTime(&holdings.Holding{}) + if !errors.Is(err, errCurrencyStatisticsUnset) { + t.Errorf("expected: %v, received %v", errCurrencyStatisticsUnset, err) + } + + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + err = s.AddHoldingsForTime(&holdings.Holding{ + Pair: p, + Asset: a, + Exchange: exch, + Timestamp: tt, + InitialFunds: 1337, + PositionsSize: 1337, + PositionsValue: 1337, + SoldAmount: 1337, + SoldValue: 1337, + BoughtAmount: 1337, + BoughtValue: 1337, + RemainingFunds: 1337, + TotalValueDifference: 1337, + ChangeInTotalValuePercent: 1337, + BoughtValueDifference: 1337, + SoldValueDifference: 1337, + PositionsValueDifference: 1337, + TotalValue: 1337, + TotalFees: 1337, + TotalValueLostToVolumeSizing: 1337, + TotalValueLostToSlippage: 1337, + TotalValueLost: 1337, + RiskFreeRate: 1337, + }) + if err != nil { + t.Error(err) + } +} + +func TestAddComplianceSnapshotForTime(t *testing.T) { + tt := time.Now() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + s := Statistic{} + + err := s.AddComplianceSnapshotForTime(compliance.Snapshot{}, nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + err = s.AddComplianceSnapshotForTime(compliance.Snapshot{}, &fill.Fill{}) + if !errors.Is(err, errExchangeAssetPairStatsUnset) { + t.Errorf("expected: %v, received %v", errExchangeAssetPairStatsUnset, err) + } + s.setupMap(exch, a) + s.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + err = s.AddComplianceSnapshotForTime(compliance.Snapshot{}, &fill.Fill{}) + if !errors.Is(err, errCurrencyStatisticsUnset) { + t.Errorf("expected: %v, received %v", errCurrencyStatisticsUnset, err) + } + + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + err = s.AddComplianceSnapshotForTime(compliance.Snapshot{ + Timestamp: tt, + }, &fill.Fill{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + }) + if err != nil { + t.Error(err) + } +} + +func TestSerialise(t *testing.T) { + s := Statistic{} + _, err := s.Serialise() + if err != nil { + t.Error(err) + } +} + +func TestSetStrategyName(t *testing.T) { + s := Statistic{} + s.SetStrategyName("test") + if s.StrategyName != "test" { + t.Error("expected test") + } +} + +func TestPrintTotalResults(t *testing.T) { + s := Statistic{} + s.BiggestDrawdown = s.GetTheBiggestDrawdownAcrossCurrencies([]FinalResultsHolder{ + { + Exchange: "test", + MaxDrawdown: currencystatistics.Swing{ + DrawdownPercent: 1337, + }, + }, + }) + s.BestStrategyResults = s.GetBestStrategyPerformer([]FinalResultsHolder{ + { + Exchange: "test", + Asset: asset.Spot, + Pair: currency.NewPair(currency.BTC, currency.DOGE), + MaxDrawdown: currencystatistics.Swing{}, + MarketMovement: 1337, + StrategyMovement: 1337, + }, + }) + s.BestMarketMovement = s.GetBestMarketPerformer([]FinalResultsHolder{ + { + Exchange: "test", + MarketMovement: 1337, + }, + }) + s.PrintTotalResults() +} + +func TestGetBestStrategyPerformer(t *testing.T) { + s := Statistic{} + resp := s.GetBestStrategyPerformer(nil) + if resp.Exchange != "" { + t.Error("expected unset details") + } + + resp = s.GetBestStrategyPerformer([]FinalResultsHolder{ + { + Exchange: "test", + Asset: asset.Spot, + Pair: currency.NewPair(currency.BTC, currency.DOGE), + MaxDrawdown: currencystatistics.Swing{}, + MarketMovement: 1337, + StrategyMovement: 1337, + }, + { + Exchange: "test2", + Asset: asset.Spot, + Pair: currency.NewPair(currency.BTC, currency.DOGE), + MaxDrawdown: currencystatistics.Swing{}, + MarketMovement: 1338, + StrategyMovement: 1338, + }, + }) + + if resp.Exchange != "test2" { + t.Error("expected test2") + } +} + +func TestGetTheBiggestDrawdownAcrossCurrencies(t *testing.T) { + s := Statistic{} + result := s.GetTheBiggestDrawdownAcrossCurrencies(nil) + if result.Exchange != "" { + t.Error("expected empty") + } + + result = s.GetTheBiggestDrawdownAcrossCurrencies([]FinalResultsHolder{ + { + Exchange: "test", + MaxDrawdown: currencystatistics.Swing{ + DrawdownPercent: 1337, + }, + }, + { + Exchange: "test2", + MaxDrawdown: currencystatistics.Swing{ + DrawdownPercent: 1338, + }, + }, + }) + if result.Exchange != "test2" { + t.Error("expected test2") + } +} + +func TestGetBestMarketPerformer(t *testing.T) { + s := Statistic{} + result := s.GetBestMarketPerformer(nil) + if result.Exchange != "" { + t.Error("expected empty") + } + + result = s.GetBestMarketPerformer([]FinalResultsHolder{ + { + Exchange: "test", + MarketMovement: 1337, + }, + { + Exchange: "test2", + MarketMovement: 1336, + }, + }) + if result.Exchange != "test" { + t.Error("expected test") + } +} + +func TestPrintAllEvents(t *testing.T) { + s := Statistic{} + s.PrintAllEvents() + tt := time.Now() + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + err := s.SetupEventForTime(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + + err = s.SetEventForOffset(&fill.Fill{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Direction: gctorder.Buy, + Amount: 1337, + ClosePrice: 1337, + VolumeAdjustedPrice: 1337, + PurchasePrice: 1337, + ExchangeFee: 1337, + Slippage: 1337, + }) + if err != nil { + t.Error(err) + } + + err = s.SetEventForOffset(&signal.Signal{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + ClosePrice: 1337, + Direction: gctorder.Buy, + }) + if err != nil { + t.Error(err) + } + + s.PrintAllEvents() +} + +func TestCalculateTheResults(t *testing.T) { + s := Statistic{} + err := s.CalculateAllResults() + if err != nil { + t.Error(err) + } + + tt := time.Now() + tt2 := time.Now().Add(time.Hour) + exch := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + p2 := currency.NewPair(currency.DOGE, currency.DOGE) + err = s.SetupEventForTime(nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }) + if err != nil { + t.Error(err) + } + err = s.SetEventForOffset(&signal.Signal{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + OpenPrice: 1337, + HighPrice: 1337, + LowPrice: 1337, + ClosePrice: 1337, + Volume: 1337, + Direction: gctorder.Buy, + }) + if err != nil { + t.Error(err) + } + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p2, + AssetType: a, + }, + Open: 1338, + Close: 1338, + Low: 1338, + High: 1338, + Volume: 1338, + }) + if err != nil { + t.Error(err) + } + + err = s.SetEventForOffset(&signal.Signal{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p2, + AssetType: a, + }, + OpenPrice: 1337, + HighPrice: 1337, + LowPrice: 1337, + ClosePrice: 1337, + Volume: 1337, + Direction: gctorder.Buy, + }) + if err != nil { + t.Error(err) + } + + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt2, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1338, + Close: 1338, + Low: 1338, + High: 1338, + Volume: 1338, + }) + if err != nil { + t.Error(err) + } + err = s.SetEventForOffset(&signal.Signal{ + Base: event.Base{ + Exchange: exch, + Time: tt2, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + OpenPrice: 1338, + HighPrice: 1338, + LowPrice: 1338, + ClosePrice: 1338, + Volume: 1338, + Direction: gctorder.Buy, + }) + if err != nil { + t.Error(err) + } + + err = s.SetupEventForTime(&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt2, + Interval: gctkline.OneDay, + CurrencyPair: p2, + AssetType: a, + }, + Open: 1338, + Close: 1338, + Low: 1338, + High: 1338, + Volume: 1338, + }) + if err != nil { + t.Error(err) + } + err = s.SetEventForOffset(&signal.Signal{ + Base: event.Base{ + Exchange: exch, + Time: tt2, + Interval: gctkline.OneDay, + CurrencyPair: p2, + AssetType: a, + }, + OpenPrice: 1338, + HighPrice: 1338, + LowPrice: 1338, + ClosePrice: 1338, + Volume: 1338, + Direction: gctorder.Buy, + }) + if err != nil { + t.Error(err) + } + + s.ExchangeAssetPairStatistics[exch][a][p].Events[1].Holdings.InitialFunds = 1337 + s.ExchangeAssetPairStatistics[exch][a][p].Events[1].Holdings.TotalValue = 13337 + s.ExchangeAssetPairStatistics[exch][a][p2].Events[1].Holdings.InitialFunds = 1337 + s.ExchangeAssetPairStatistics[exch][a][p2].Events[1].Holdings.TotalValue = 13337 + + err = s.CalculateAllResults() + if err != nil { + t.Error(err) + } +} diff --git a/backtester/eventhandlers/statistics/statistics_types.go b/backtester/eventhandlers/statistics/statistics_types.go new file mode 100644 index 00000000..1b9ef016 --- /dev/null +++ b/backtester/eventhandlers/statistics/statistics_types.go @@ -0,0 +1,85 @@ +package statistics + +import ( + "errors" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics/currencystatistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +var ( + errExchangeAssetPairStatsUnset = errors.New("exchangeAssetPairStatistics not setup") + errCurrencyStatisticsUnset = errors.New("no data") +) + +// Statistic holds all statistical information for a backtester run, from drawdowns to ratios. +// Any currency specific information is handled in currencystatistics +type Statistic struct { + StrategyName string `json:"strategy-name"` + StrategyDescription string `json:"strategy-description"` + StrategyNickname string `json:"strategy-nickname"` + StrategyGoal string `json:"strategy-goal"` + ExchangeAssetPairStatistics map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic `json:"-"` + RiskFreeRate float64 `json:"risk-free-rate"` + TotalBuyOrders int64 `json:"total-buy-orders"` + TotalSellOrders int64 `json:"total-sell-orders"` + TotalOrders int64 `json:"total-orders"` + BiggestDrawdown *FinalResultsHolder `json:"biggest-drawdown,omitempty"` + BestStrategyResults *FinalResultsHolder `json:"best-start-results,omitempty"` + BestMarketMovement *FinalResultsHolder `json:"best-market-movement,omitempty"` + AllStats []currencystatistics.CurrencyStatistic `json:"results"` // as ExchangeAssetPairStatistics cannot be rendered via json.Marshall, we append all result to this slice instead + WasAnyDataMissing bool `json:"was-any-data-missing"` +} + +// FinalResultsHolder holds important stats about a currency's performance +type FinalResultsHolder struct { + Exchange string `json:"exchange"` + Asset asset.Item `json:"asset"` + Pair currency.Pair `json:"currency"` + MaxDrawdown currencystatistics.Swing `json:"max-drawdown"` + MarketMovement float64 `json:"market-movement"` + StrategyMovement float64 `json:"strategy-movement"` +} + +// Handler interface details what a statistic is expected to do +type Handler interface { + SetStrategyName(string) + SetupEventForTime(common.DataEventHandler) error + SetEventForOffset(e common.EventHandler) error + AddHoldingsForTime(*holdings.Holding) error + AddComplianceSnapshotForTime(compliance.Snapshot, fill.Event) error + CalculateAllResults() error + Reset() + Serialise() (string, error) +} + +// Results holds some statistics on results +type Results struct { + Pair string `json:"pair"` + TotalEvents int `json:"totalEvents"` + TotalTransactions int `json:"totalTransactions"` + Events []ResultEvent `json:"events"` + Transactions []ResultTransactions `json:"transactions"` + StrategyName string `json:"strategyName"` +} + +// ResultTransactions stores details on a transaction +type ResultTransactions struct { + Time time.Time `json:"time"` + Direction gctorder.Side `json:"direction"` + Price float64 `json:"price"` + Amount float64 `json:"amount"` + Reason string `json:"reason,omitempty"` +} + +// ResultEvent stores the time +type ResultEvent struct { + Time time.Time `json:"time"` +} diff --git a/backtester/eventhandlers/strategies/README.md b/backtester/eventhandlers/strategies/README.md new file mode 100644 index 00000000..e8efeb35 --- /dev/null +++ b/backtester/eventhandlers/strategies/README.md @@ -0,0 +1,61 @@ +# GoCryptoTrader Backtester: Strategies package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This strategies package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Strategies package overview + +Strategies are programmed instruction sets which act upon pricing data. After data has been loaded into the GoCryptoTrader, each tick is passed through your loaded strategy and is analysed in either the `OnSignal` function or the `OnSignals` function. + +### Creating strategies +The level customisation allowed in a strategy is extensive. They are required to be written in Golang. +The strategy must adhere to the interface `strategies.Handler` by implementing the function signature `OnSignal(d data.Handler, _ portfolio.Handler) (signal.Event, error)`. The `data.Handler` allows you to access the current pricing information as well as all previous intervals. You can use this to feed any Technical Analysis package to create strategies based on market movements such as RSI (see `./strategies/rsi/rsi.go`). Strategies can also access the portfolio manager on signal(s) which allows analysis of existing holdings value, current orders and positions of other currencies in order to make complex decisions. +When outputting the `signal.Event`, you are not dictating the price of an order, but rather signalling to the portfolio manager what ideally should occur. These options are to buy, sell or do nothing. Additional signals are to flag missing data, handled via checking `d.HasDataAtTime(d.Latest().GetTime()` to prevent any issues from occurring down the line. +Additionally, you can utilise the `AppendWhy()` function to help understand what went into make a signalling decision when reviewing the results. + +### What does Simultaneous Signal Processing mean? +GoCryptoTrader Backtester config files may contain multiple `ExchangeSettings` which defined exchange, asset and currency pairs to iterate through a period of time. + +If there are multiple entries to `ExchangeSettings` and SimultaneousProcessing is disabled, then each individual exchange, asset and currency pair candle event is evaluated individually and does not know about other exchange, asset and currency pair data events. It is a way to test a singular strategy against multiple assets simultaneously. But it isn't defined as Simultaneous Processing +Simultaneous Signal Processing is a setting which allows multiple `ExchangeSettings` data events for a candle event to be considered simultaneously. This means that you can check if the price of BTC-USDT is 5% greater on Binance than it is on Kraken and choose to make signal a BUY event for Kraken and not Binance. + +It allows for complex strategical decisions to be made when you consider the scope of the entire market at a given time, rather than in a vacuum when SimultaneousSignalProcessing is disabled. + +### Loading strategies +Each strategy has a unique name and is to be added to the function `getStrategies()` in order to be recognised. + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/strategies/base/README.md b/backtester/eventhandlers/strategies/base/README.md new file mode 100644 index 00000000..010fe680 --- /dev/null +++ b/backtester/eventhandlers/strategies/base/README.md @@ -0,0 +1,45 @@ +# GoCryptoTrader Backtester: Base package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This base package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Base package overview + +The strategy base file has basic implementations of the `strategies.Handler` interface. Add any functions that can be used across all strategies here. + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/strategies/base/base.go b/backtester/eventhandlers/strategies/base/base.go new file mode 100644 index 00000000..6ff53075 --- /dev/null +++ b/backtester/eventhandlers/strategies/base/base.go @@ -0,0 +1,48 @@ +package base + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" +) + +// Strategy is base implementation of the Handler interface +type Strategy struct { + useSimultaneousProcessing bool +} + +// GetBaseData returns the non-interface version of the Handler +func (s *Strategy) GetBaseData(d data.Handler) (signal.Signal, error) { + if d == nil { + return signal.Signal{}, common.ErrNilArguments + } + latest := d.Latest() + if latest == nil { + return signal.Signal{}, common.ErrNilEvent + } + return signal.Signal{ + Base: event.Base{ + Offset: latest.GetOffset(), + Exchange: latest.GetExchange(), + Time: latest.GetTime(), + CurrencyPair: latest.Pair(), + AssetType: latest.GetAssetType(), + Interval: latest.GetInterval(), + }, + ClosePrice: latest.ClosePrice(), + HighPrice: latest.HighPrice(), + OpenPrice: latest.OpenPrice(), + LowPrice: latest.LowPrice(), + }, nil +} + +// UseSimultaneousProcessing returns whether multiple currencies can be assessed in one go +func (s *Strategy) UseSimultaneousProcessing() bool { + return s.useSimultaneousProcessing +} + +// SetSimultaneousProcessing sets whether multiple currencies can be assessed in one go +func (s *Strategy) SetSimultaneousProcessing(b bool) { + s.useSimultaneousProcessing = b +} diff --git a/backtester/eventhandlers/strategies/base/base_test.go b/backtester/eventhandlers/strategies/base/base_test.go new file mode 100644 index 00000000..c78aadab --- /dev/null +++ b/backtester/eventhandlers/strategies/base/base_test.go @@ -0,0 +1,71 @@ +package base + +import ( + "errors" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + datakline "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +func TestGetBase(t *testing.T) { + s := Strategy{} + _, err := s.GetBaseData(nil) + if !errors.Is(err, common.ErrNilArguments) { + t.Errorf("expected: %v, received %v", common.ErrNilArguments, err) + } + + _, err = s.GetBaseData(&datakline.DataFromKline{}) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + tt := time.Now() + exch := "binance" + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := data.Base{} + d.SetStream([]common.DataEventHandler{&kline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: tt, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }}) + + d.Next() + _, err = s.GetBaseData(&datakline.DataFromKline{ + Item: gctkline.Item{}, + Base: d, + Range: gctkline.IntervalRangeHolder{}, + }) + if err != nil { + t.Error(err) + } +} + +func TestSetSimultaneousProcessing(t *testing.T) { + s := Strategy{} + is := s.UseSimultaneousProcessing() + if is { + t.Error("expected false") + } + s.SetSimultaneousProcessing(true) + is = s.UseSimultaneousProcessing() + if !is { + t.Error("expected true") + } +} diff --git a/backtester/eventhandlers/strategies/base/base_types.go b/backtester/eventhandlers/strategies/base/base_types.go new file mode 100644 index 00000000..b8d7c5e9 --- /dev/null +++ b/backtester/eventhandlers/strategies/base/base_types.go @@ -0,0 +1,11 @@ +package base + +import "errors" + +var ( + ErrCustomSettingsUnsupported = errors.New("custom settings not supported") + ErrSimultaneousProcessingNotSupported = errors.New("does not support simultaneous processing and could not be loaded") + ErrStrategyNotFound = errors.New("not found. Please ensure the strategy-settings field 'name' is spelled properly in your .start config") + ErrInvalidCustomSettings = errors.New("invalid custom settings in config") + ErrTooMuchBadData = errors.New("backtesting cannot continue as there is too much invalid data. Please review your dataset") +) diff --git a/backtester/eventhandlers/strategies/dollarcostaverage/README.md b/backtester/eventhandlers/strategies/dollarcostaverage/README.md new file mode 100644 index 00000000..f6223276 --- /dev/null +++ b/backtester/eventhandlers/strategies/dollarcostaverage/README.md @@ -0,0 +1,47 @@ +# GoCryptoTrader Backtester: Dollarcostaverage package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/dollarcostaverage) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This dollarcostaverage package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Dollarcostaverage package overview + +The dollar cost average is a strategy which is designed to purchase on _every_ data candle. Unless data is missing, all output signals will be to buy. +This strategy supports simultaneous signal processing, aka `config.StrategySettings.SimultaneousSignalProcessing` set to true will use the function `OnSignals(d []data.Handler, p portfolio.Handler) ([]signal.Event, error)`. This function, like the basic `OnSignal` function, will signal to buy on every iteration. +This strategy does not support customisation + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage.go b/backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage.go new file mode 100644 index 00000000..a6f1e531 --- /dev/null +++ b/backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage.go @@ -0,0 +1,92 @@ +package dollarcostaverage + +import ( + "fmt" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + gctcommon "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const ( + // Name is the strategy name + Name = "dollarcostaverage" + description = `Dollar-cost averaging (DCA) is an investment strategy in which an investor divides up the total amount to be invested across periodic purchases of a target asset in an effort to reduce the impact of volatility on the overall purchase. The purchases occur regardless of the asset's price and at regular intervals. In effect, this strategy removes much of the detailed work of attempting to time the market in order to make purchases of equities at the best prices.` +) + +// Strategy is an implementation of the Handler interface +type Strategy struct { + base.Strategy +} + +// Name returns the name +func (s *Strategy) Name() string { + return Name +} + +// Description provides a nice overview of the strategy +// be it definition of terms or to highlight its purpose +func (s *Strategy) Description() string { + return description +} + +// OnSignal handles a data event and returns what action the strategy believes should occur +// For dollarcostaverage, this means returning a buy signal on every event +func (s *Strategy) OnSignal(d data.Handler, _ portfolio.Handler) (signal.Event, error) { + if d == nil { + return nil, common.ErrNilEvent + } + es, err := s.GetBaseData(d) + if err != nil { + return nil, err + } + + if !d.HasDataAtTime(d.Latest().GetTime()) { + es.SetDirection(common.MissingData) + es.AppendReason(fmt.Sprintf("missing data at %v, cannot perform any actions", d.Latest().GetTime())) + return &es, nil + } + + es.SetPrice(d.Latest().ClosePrice()) + es.SetDirection(order.Buy) + es.AppendReason("DCA purchases on every iteration") + return &es, nil +} + +// SupportsSimultaneousProcessing highlights whether the strategy can handle multiple currency calculation +func (s *Strategy) SupportsSimultaneousProcessing() bool { + return true +} + +// OnSimultaneousSignals analyses multiple data points simultaneously, allowing flexibility +// in allowing a strategy to only place an order for X currency if Y currency's price is Z +// For dollarcostaverage, the strategy is always "buy", so it uses the OnSignal function +func (s *Strategy) OnSimultaneousSignals(d []data.Handler, p portfolio.Handler) ([]signal.Event, error) { + var resp []signal.Event + var errs gctcommon.Errors + for i := range d { + sigEvent, err := s.OnSignal(d[i], nil) + if err != nil { + errs = append(errs, err) + } else { + resp = append(resp, sigEvent) + } + } + + if len(errs) > 0 { + return nil, errs + } + return resp, nil +} + +// SetCustomSettings not required for DCA +func (s *Strategy) SetCustomSettings(_ map[string]interface{}) error { + return base.ErrCustomSettingsUnsupported +} + +// SetDefaults not required for DCA +func (s *Strategy) SetDefaults() {} diff --git a/backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage_test.go b/backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage_test.go new file mode 100644 index 00000000..2d363b35 --- /dev/null +++ b/backtester/eventhandlers/strategies/dollarcostaverage/dollarcostaverage_test.go @@ -0,0 +1,208 @@ +package dollarcostaverage + +import ( + "errors" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + eventkline "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +func TestName(t *testing.T) { + d := Strategy{} + n := d.Name() + if n != Name { + t.Errorf("expected %v", Name) + } +} + +func TestSupportsSimultaneousProcessing(t *testing.T) { + s := Strategy{} + if !s.SupportsSimultaneousProcessing() { + t.Error("expected true") + } +} + +func TestSetCustomSettings(t *testing.T) { + s := Strategy{} + err := s.SetCustomSettings(nil) + if !errors.Is(err, base.ErrCustomSettingsUnsupported) { + t.Errorf("expected: %v, received %v", base.ErrCustomSettingsUnsupported, err) + } +} + +func TestOnSignal(t *testing.T) { + s := Strategy{} + _, err := s.OnSignal(nil, nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + + dStart := time.Date(2020, 1, 0, 0, 0, 0, 0, time.UTC) + dInsert := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + dEnd := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC) + exch := "binance" + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := data.Base{} + d.SetStream([]common.DataEventHandler{&eventkline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: dInsert, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }}) + d.Next() + da := &kline.DataFromKline{ + Item: gctkline.Item{}, + Base: d, + Range: gctkline.IntervalRangeHolder{}, + } + var resp signal.Event + resp, err = s.OnSignal(da, nil) + if err != nil { + t.Error(err) + } + if resp.GetDirection() != common.MissingData { + t.Error("expected missing data") + } + + da.Item = gctkline.Item{ + Exchange: exch, + Pair: p, + Asset: a, + Interval: gctkline.OneDay, + Candles: []gctkline.Candle{ + { + Time: dInsert, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }, + } + err = da.Load() + if err != nil { + t.Error(err) + } + + ranger := gctkline.CalculateCandleDateRanges(dStart, dEnd, gctkline.OneDay, 100000) + da.Range = ranger + _ = da.Range.VerifyResultsHaveData(da.Item.Candles) + resp, err = s.OnSignal(da, nil) + if err != nil { + t.Error(err) + } + if resp.GetDirection() != gctorder.Buy { + t.Errorf("expected buy, received %v", resp.GetDirection()) + } +} + +func TestOnSignals(t *testing.T) { + s := Strategy{} + _, err := s.OnSignal(nil, nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + dStart := time.Date(2020, 1, 0, 0, 0, 0, 0, time.UTC) + dInsert := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + dEnd := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC) + exch := "binance" + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := data.Base{} + d.SetStream([]common.DataEventHandler{&eventkline.Kline{ + Base: event.Base{ + Offset: 1, + Exchange: exch, + Time: dInsert, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }}) + d.Next() + da := &kline.DataFromKline{ + Item: gctkline.Item{}, + Base: d, + Range: gctkline.IntervalRangeHolder{}, + } + var resp []signal.Event + resp, err = s.OnSimultaneousSignals([]data.Handler{da}, nil) + if err != nil { + t.Error(err) + } + if len(resp) != 1 { + t.Fatal("expected 1 response") + } + if resp[0].GetDirection() != common.MissingData { + t.Error("expected missing data") + } + + da.Item = gctkline.Item{ + Exchange: exch, + Pair: p, + Asset: a, + Interval: gctkline.OneDay, + Candles: []gctkline.Candle{ + { + Time: dInsert, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }, + } + err = da.Load() + if err != nil { + t.Error(err) + } + + ranger := gctkline.CalculateCandleDateRanges(dStart, dEnd, gctkline.OneDay, 100000) + da.Range = ranger + _ = da.Range.VerifyResultsHaveData(da.Item.Candles) + resp, err = s.OnSimultaneousSignals([]data.Handler{da}, nil) + if err != nil { + t.Error(err) + } + if len(resp) != 1 { + t.Fatal("expected 1 response") + } + if resp[0].GetDirection() != gctorder.Buy { + t.Error("expected buy") + } +} + +func TestSetDefaults(t *testing.T) { + s := Strategy{} + s.SetDefaults() + if s != (Strategy{}) { + t.Error("expected no changes") + } +} diff --git a/backtester/eventhandlers/strategies/rsi/README.md b/backtester/eventhandlers/strategies/rsi/README.md new file mode 100644 index 00000000..0a711e1c --- /dev/null +++ b/backtester/eventhandlers/strategies/rsi/README.md @@ -0,0 +1,52 @@ +# GoCryptoTrader Backtester: Rsi package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/rsi) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This rsi package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Rsi package overview + +The RSI strategy utilises [the gct-ta RSI package](https://github.com/thrasher-corp/gct-ta) to analyse market signals and output buy or sell signals based on the RSI output. +This strategy does not support `SimultaneousSignalProcessing` aka [use-simultaneous-signal-processing](/backtester/config/README.md). +This strategy does support strategy customisation in the following ways: + +| Field | Description | Example | +| --- | ------- | --- | +|rsi-high| The upper bounds of RSI that when met, will trigger a Sell signal | 70 | +|rsi-low| The lower bounds of RSI that when met, will trigger a Buy signal | 30 | +|rsi-period| The consecutive candle periods used in order to generate a value. All values less than this number cannot output a buy or sell signal | 14 | + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventhandlers/strategies/rsi/rsi.go b/backtester/eventhandlers/strategies/rsi/rsi.go new file mode 100644 index 00000000..26227a83 --- /dev/null +++ b/backtester/eventhandlers/strategies/rsi/rsi.go @@ -0,0 +1,166 @@ +package rsi + +import ( + "fmt" + "time" + + "github.com/thrasher-corp/gct-ta/indicators" + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + gctcommon "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const ( + // Name is the strategy name + Name = "rsi" + rsiPeriodKey = "rsi-period" + rsiLowKey = "rsi-low" + rsiHighKey = "rsi-high" + description = `The relative strength index is a technical indicator used in the analysis of financial markets. It is intended to chart the current and historical strength or weakness of a stock or market based on the closing prices of a recent trading period` +) + +// Strategy is an implementation of the Handler interface +type Strategy struct { + base.Strategy + rsiPeriod float64 + rsiLow float64 + rsiHigh float64 +} + +// Name returns the name of the strategy +func (s *Strategy) Name() string { + return Name +} + +// Description provides a nice overview of the strategy +// be it definition of terms or to highlight its purpose +func (s *Strategy) Description() string { + return description +} + +// OnSignal handles a data event and returns what action the strategy believes should occur +// For rsi, this means returning a buy signal when rsi is at or below a certain level, and a +// sell signal when it is at or above a certain level +func (s *Strategy) OnSignal(d data.Handler, _ portfolio.Handler) (signal.Event, error) { + if d == nil { + return nil, common.ErrNilEvent + } + es, err := s.GetBaseData(d) + if err != nil { + return nil, err + } + es.SetPrice(d.Latest().ClosePrice()) + offset := d.Offset() + + if offset <= int(s.rsiPeriod) { + es.AppendReason("Not enough data for signal generation") + es.SetDirection(common.DoNothing) + return &es, nil + } + + dataRange := d.StreamClose() + var massagedData []float64 + massagedData, err = s.massageMissingData(dataRange, es.GetTime()) + if err != nil { + return nil, err + } + rsi := indicators.RSI(massagedData, int(s.rsiPeriod)) + latestRSIValue := rsi[len(rsi)-1] + if !d.HasDataAtTime(d.Latest().GetTime()) { + es.SetDirection(common.MissingData) + es.AppendReason(fmt.Sprintf("missing data at %v, cannot perform any actions. RSI %v", d.Latest().GetTime(), latestRSIValue)) + return &es, nil + } + + switch { + case latestRSIValue >= s.rsiHigh: + es.SetDirection(order.Sell) + case latestRSIValue <= s.rsiLow: + es.SetDirection(order.Buy) + default: + es.SetDirection(common.DoNothing) + } + es.AppendReason(fmt.Sprintf("RSI at %.2f", latestRSIValue)) + + return &es, nil +} + +// SupportsSimultaneousProcessing highlights whether the strategy can handle multiple currency calculation +// There is nothing actually stopping this strategy from considering multiple currencies at once +// but for demonstration purposes, this strategy does not +func (s *Strategy) SupportsSimultaneousProcessing() bool { + return false +} + +// OnSimultaneousSignals analyses multiple data points simultaneously, allowing flexibility +// in allowing a strategy to only place an order for X currency if Y currency's price is Z +// For rsi, multi-currency signal processing is unsupported for demonstration purposes +func (s *Strategy) OnSimultaneousSignals(_ []data.Handler, _ portfolio.Handler) ([]signal.Event, error) { + return nil, base.ErrSimultaneousProcessingNotSupported +} + +// SetCustomSettings allows a user to modify the RSI limits in their config +func (s *Strategy) SetCustomSettings(customSettings map[string]interface{}) error { + for k, v := range customSettings { + switch k { + case rsiHighKey: + rsiHigh, ok := v.(float64) + if !ok || rsiHigh <= 0 { + return fmt.Errorf("%w provided rsi-high value could not be parsed: %v", base.ErrInvalidCustomSettings, v) + } + s.rsiHigh = rsiHigh + case rsiLowKey: + rsiLow, ok := v.(float64) + if !ok || rsiLow <= 0 { + return fmt.Errorf("%w provided rsi-low value could not be parsed: %v", base.ErrInvalidCustomSettings, v) + } + s.rsiLow = rsiLow + case rsiPeriodKey: + rsiPeriod, ok := v.(float64) + if !ok || rsiPeriod <= 0 { + return fmt.Errorf("%w provided rsi-period value could not be parsed: %v", base.ErrInvalidCustomSettings, v) + } + s.rsiPeriod = rsiPeriod + default: + return fmt.Errorf("%w unrecognised custom setting key %v with value %v. Cannot apply", base.ErrInvalidCustomSettings, k, v) + } + } + + return nil +} + +// SetDefaults sets the custom settings to their default values +func (s *Strategy) SetDefaults() { + s.rsiHigh = 70 + s.rsiLow = 30 + s.rsiPeriod = 14 +} + +// massageMissingData will replace missing data with the previous candle's data +// this will ensure that RSI can be calculated correctly +// the decision to handle missing data occurs at the strategy level, not all strategies +// may wish to modify data +func (s *Strategy) massageMissingData(data []float64, t time.Time) ([]float64, error) { + var resp []float64 + var missingDataStreak float64 + for i := range data { + if data[i] == 0 && i > int(s.rsiPeriod) { + data[i] = data[i-1] + missingDataStreak++ + } else { + missingDataStreak = 0 + } + if missingDataStreak >= s.rsiPeriod { + return nil, fmt.Errorf("missing data exceeds RSI period length of %v at %s and will distort results. %w", + s.rsiPeriod, + t.Format(gctcommon.SimpleTimeFormat), + base.ErrTooMuchBadData) + } + resp = append(resp, data[i]) + } + return resp, nil +} diff --git a/backtester/eventhandlers/strategies/rsi/rsi_test.go b/backtester/eventhandlers/strategies/rsi/rsi_test.go new file mode 100644 index 00000000..e206cc5b --- /dev/null +++ b/backtester/eventhandlers/strategies/rsi/rsi_test.go @@ -0,0 +1,209 @@ +package rsi + +import ( + "errors" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/data/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + eventkline "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +func TestName(t *testing.T) { + d := Strategy{} + n := d.Name() + if n != Name { + t.Errorf("expected %v", Name) + } +} + +func TestSupportsSimultaneousProcessing(t *testing.T) { + s := Strategy{} + if s.SupportsSimultaneousProcessing() { + t.Error("expected false") + } +} + +func TestSetCustomSettings(t *testing.T) { + s := Strategy{} + err := s.SetCustomSettings(nil) + if err != nil { + t.Error(err) + } + float14 := float64(14) + mappalopalous := make(map[string]interface{}) + mappalopalous[rsiPeriodKey] = float14 + mappalopalous[rsiLowKey] = float14 + mappalopalous[rsiHighKey] = float14 + + err = s.SetCustomSettings(mappalopalous) + if err != nil { + t.Error(err) + } + + mappalopalous[rsiPeriodKey] = "14" + err = s.SetCustomSettings(mappalopalous) + if !errors.Is(err, base.ErrInvalidCustomSettings) { + t.Errorf("expected: %v, received %v", base.ErrInvalidCustomSettings, err) + } + + mappalopalous[rsiPeriodKey] = float14 + mappalopalous[rsiLowKey] = "14" + err = s.SetCustomSettings(mappalopalous) + if !errors.Is(err, base.ErrInvalidCustomSettings) { + t.Errorf("expected: %v, received %v", base.ErrInvalidCustomSettings, err) + } + + mappalopalous[rsiLowKey] = float14 + mappalopalous[rsiHighKey] = "14" + err = s.SetCustomSettings(mappalopalous) + if !errors.Is(err, base.ErrInvalidCustomSettings) { + t.Errorf("expected: %v, received %v", base.ErrInvalidCustomSettings, err) + } + + mappalopalous[rsiHighKey] = float14 + mappalopalous["lol"] = float14 + err = s.SetCustomSettings(mappalopalous) + if !errors.Is(err, base.ErrInvalidCustomSettings) { + t.Errorf("expected: %v, received %v", base.ErrInvalidCustomSettings, err) + } +} + +func TestOnSignal(t *testing.T) { + s := Strategy{} + _, err := s.OnSignal(nil, nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + dStart := time.Date(2020, 1, 0, 0, 0, 0, 0, time.UTC) + dInsert := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + dEnd := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC) + exch := "binance" + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := data.Base{} + d.SetStream([]common.DataEventHandler{&eventkline.Kline{ + Base: event.Base{ + Offset: 3, + Exchange: exch, + Time: dInsert, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }}, + ) + d.Next() + da := &kline.DataFromKline{ + Item: gctkline.Item{}, + Base: d, + Range: gctkline.IntervalRangeHolder{}, + } + var resp signal.Event + _, err = s.OnSignal(da, nil) + if !errors.Is(err, base.ErrTooMuchBadData) { + t.Fatalf("expected: %v, received %v", base.ErrTooMuchBadData, err) + } + + s.rsiPeriod = 1 + _, err = s.OnSignal(da, nil) + if err != nil { + t.Error(err) + } + + da.Item = gctkline.Item{ + Exchange: exch, + Pair: p, + Asset: a, + Interval: gctkline.OneDay, + Candles: []gctkline.Candle{ + { + Time: dInsert, + Open: 1337, + High: 1337, + Low: 1337, + Close: 1337, + Volume: 1337, + }, + }, + } + err = da.Load() + if err != nil { + t.Error(err) + } + + ranger := gctkline.CalculateCandleDateRanges(dStart, dEnd, gctkline.OneDay, 100000) + da.Range = ranger + _ = da.Range.VerifyResultsHaveData(da.Item.Candles) + resp, err = s.OnSignal(da, nil) + if err != nil { + t.Error(err) + } + if resp.GetDirection() != common.DoNothing { + t.Error("expected do nothing") + } +} + +func TestOnSignals(t *testing.T) { + s := Strategy{} + _, err := s.OnSignal(nil, nil) + if !errors.Is(err, common.ErrNilEvent) { + t.Errorf("expected: %v, received %v", common.ErrNilEvent, err) + } + dInsert := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) + exch := "binance" + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + d := data.Base{} + d.SetStream([]common.DataEventHandler{&eventkline.Kline{ + Base: event.Base{ + Exchange: exch, + Time: dInsert, + Interval: gctkline.OneDay, + CurrencyPair: p, + AssetType: a, + }, + Open: 1337, + Close: 1337, + Low: 1337, + High: 1337, + Volume: 1337, + }}) + d.Next() + da := &kline.DataFromKline{ + Item: gctkline.Item{}, + Base: d, + Range: gctkline.IntervalRangeHolder{}, + } + _, err = s.OnSimultaneousSignals([]data.Handler{da}, nil) + if !errors.Is(err, base.ErrSimultaneousProcessingNotSupported) { + t.Errorf("expected: %v, received %v", base.ErrSimultaneousProcessingNotSupported, err) + } +} + +func TestSetDefaults(t *testing.T) { + s := Strategy{} + s.SetDefaults() + if s.rsiHigh != 70.0 { + t.Error("expected 70") + } + if s.rsiLow != 30.0 { + t.Error("expected 30") + } + if s.rsiPeriod != 14.0 { + t.Error("expected 14") + } +} diff --git a/backtester/eventhandlers/strategies/strategies.go b/backtester/eventhandlers/strategies/strategies.go new file mode 100644 index 00000000..5860791b --- /dev/null +++ b/backtester/eventhandlers/strategies/strategies.go @@ -0,0 +1,43 @@ +package strategies + +import ( + "fmt" + "strings" + + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/dollarcostaverage" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/rsi" +) + +// LoadStrategyByName returns the strategy by its name +func LoadStrategyByName(name string, useSimultaneousProcessing bool) (Handler, error) { + strats := GetStrategies() + for i := range strats { + if !strings.EqualFold(name, strats[i].Name()) { + continue + } + if useSimultaneousProcessing { + if !strats[i].SupportsSimultaneousProcessing() { + return nil, fmt.Errorf( + "strategy '%v' %w", + name, + base.ErrSimultaneousProcessingNotSupported) + } + strats[i].SetSimultaneousProcessing(useSimultaneousProcessing) + } + return strats[i], nil + } + return nil, fmt.Errorf("strategy '%v' %w", name, base.ErrStrategyNotFound) +} + +// GetStrategies returns a static list of set strategies +// they must be set in here for the backtester to recognise them +func GetStrategies() []Handler { + var strats []Handler + strats = append(strats, + new(dollarcostaverage.Strategy), + new(rsi.Strategy), + ) + + return strats +} diff --git a/backtester/eventhandlers/strategies/strategies_test.go b/backtester/eventhandlers/strategies/strategies_test.go new file mode 100644 index 00000000..0f493059 --- /dev/null +++ b/backtester/eventhandlers/strategies/strategies_test.go @@ -0,0 +1,56 @@ +package strategies + +import ( + "errors" + "testing" + + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/base" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/dollarcostaverage" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/strategies/rsi" +) + +func TestGetStrategies(t *testing.T) { + resp := GetStrategies() + if len(resp) < 2 { + t.Error("expected at least 2 strategies to be loaded") + } +} + +func TestLoadStrategyByName(t *testing.T) { + var resp Handler + _, err := LoadStrategyByName("test", false) + if !errors.Is(err, base.ErrStrategyNotFound) { + t.Errorf("expected: %v, received %v", base.ErrStrategyNotFound, err) + } + _, err = LoadStrategyByName("test", true) + if !errors.Is(err, base.ErrStrategyNotFound) { + t.Errorf("expected: %v, received %v", base.ErrStrategyNotFound, err) + } + + resp, err = LoadStrategyByName(dollarcostaverage.Name, false) + if err != nil { + t.Error(err) + } + if resp.Name() != dollarcostaverage.Name { + t.Error("expected dca") + } + resp, err = LoadStrategyByName(dollarcostaverage.Name, true) + if err != nil { + t.Error(err) + } + if !resp.UseSimultaneousProcessing() { + t.Error("expected true") + } + + resp, err = LoadStrategyByName(rsi.Name, false) + if err != nil { + t.Error(err) + } + if resp.Name() != rsi.Name { + t.Error("expected rsi") + } + _, err = LoadStrategyByName(rsi.Name, true) + if !errors.Is(err, base.ErrSimultaneousProcessingNotSupported) { + t.Errorf("expected: %v, received %v", base.ErrSimultaneousProcessingNotSupported, err) + } +} diff --git a/backtester/eventhandlers/strategies/strategies_types.go b/backtester/eventhandlers/strategies/strategies_types.go new file mode 100644 index 00000000..530f035b --- /dev/null +++ b/backtester/eventhandlers/strategies/strategies_types.go @@ -0,0 +1,20 @@ +package strategies + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/data" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal" +) + +// Handler defines all functions required to run strategies against data events +type Handler interface { + Name() string + Description() string + OnSignal(data.Handler, portfolio.Handler) (signal.Event, error) + OnSimultaneousSignals([]data.Handler, portfolio.Handler) ([]signal.Event, error) + UseSimultaneousProcessing() bool + SupportsSimultaneousProcessing() bool + SetSimultaneousProcessing(bool) + SetCustomSettings(map[string]interface{}) error + SetDefaults() +} diff --git a/backtester/eventtypes/README.md b/backtester/eventtypes/README.md new file mode 100644 index 00000000..846273d3 --- /dev/null +++ b/backtester/eventtypes/README.md @@ -0,0 +1,47 @@ +# GoCryptoTrader Backtester: Eventtypes package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventtypes) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This eventtypes package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Eventtypes overview + +Event types are created after retrieving candle data. An individual candle is turned into a data event which is sent to the strategy for analysis. The event is then sent to the portfolio manager to determine whether there is appropriate funding, adequate risk and proper order sizing before raising an order event. The order event is taken to the exchange handler which will place the order and create a fill event. The fill event is used to update the portfolios individual holdings for analysis and decision making. +Below is an overview of how events are used +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventtypes/event/README.md b/backtester/eventtypes/event/README.md new file mode 100644 index 00000000..9513adc9 --- /dev/null +++ b/backtester/eventtypes/event/README.md @@ -0,0 +1,45 @@ +# GoCryptoTrader Backtester: Event package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This event package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Event package overview + +The event event type is an important base for all other events. It allows for consistent information to be used across all events in order to track and make decisions. Any information that is shared between events should be added to this struct + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventtypes/event/event.go b/backtester/eventtypes/event/event.go new file mode 100644 index 00000000..0d88d38c --- /dev/null +++ b/backtester/eventtypes/event/event.go @@ -0,0 +1,63 @@ +package event + +import ( + "time" + + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +// GetOffset returns the offset +func (b *Base) GetOffset() int64 { + return b.Offset +} + +// SetOffset sets the offset +func (b *Base) SetOffset(o int64) { + b.Offset = o +} + +// IsEvent returns whether the event is an event +func (b *Base) IsEvent() bool { + return true +} + +// GetTime returns the time +func (b *Base) GetTime() time.Time { + return b.Time +} + +// Pair returns the currency pair +func (b *Base) Pair() currency.Pair { + return b.CurrencyPair +} + +// GetExchange returns the exchange +func (b *Base) GetExchange() string { + return b.Exchange +} + +// GetAssetType returns the asset type +func (b *Base) GetAssetType() asset.Item { + return b.AssetType +} + +// GetInterval returns the interval +func (b *Base) GetInterval() kline.Interval { + return b.Interval +} + +// AppendReason adds reasoning for a decision being made +func (b *Base) AppendReason(y string) { + if b.Reason == "" { + b.Reason = y + } else { + b.Reason = y + ". " + b.Reason + } +} + +// GetReason returns the why +func (b *Base) GetReason() string { + return b.Reason +} diff --git a/backtester/eventtypes/event/event_test.go b/backtester/eventtypes/event/event_test.go new file mode 100644 index 00000000..d0d789ad --- /dev/null +++ b/backtester/eventtypes/event/event_test.go @@ -0,0 +1,79 @@ +package event + +import ( + "strings" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +func TestEvent_AppendWhy(t *testing.T) { + e := &Base{} + e.AppendReason("test") + y := e.GetReason() + if !strings.Contains(y, "test") { + t.Error("expected test") + } +} + +func TestEvent_GetAssetType(t *testing.T) { + e := &Base{ + AssetType: asset.Spot, + } + y := e.GetAssetType() + if y != asset.Spot { + t.Error("expected spot") + } +} + +func TestEvent_GetExchange(t *testing.T) { + e := &Base{ + Exchange: "test", + } + y := e.GetExchange() + if y != "test" { + t.Error("expected test") + } +} + +func TestEvent_GetInterval(t *testing.T) { + e := &Base{ + Interval: gctkline.OneMin, + } + y := e.GetInterval() + if y != gctkline.OneMin { + t.Error("expected one minute") + } +} + +func TestEvent_GetTime(t *testing.T) { + tt := time.Now() + e := &Base{ + Time: tt, + } + y := e.GetTime() + if !y.Equal(tt) { + t.Errorf("expected %v", tt) + } +} + +func TestEvent_IsEvent(t *testing.T) { + e := &Base{} + y := e.IsEvent() + if !y { + t.Error("it is an event") + } +} + +func TestEvent_Pair(t *testing.T) { + e := &Base{ + CurrencyPair: currency.NewPair(currency.BTC, currency.USDT), + } + y := e.Pair() + if y.IsEmpty() { + t.Error("expected currency") + } +} diff --git a/backtester/eventtypes/event/event_types.go b/backtester/eventtypes/event/event_types.go new file mode 100644 index 00000000..9c0af60d --- /dev/null +++ b/backtester/eventtypes/event/event_types.go @@ -0,0 +1,22 @@ +package event + +import ( + "time" + + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" +) + +// Base is the underlying event across all actions that occur for the backtester +// Data, fill, order events all contain the base event and store important and +// consistent information +type Base struct { + Offset int64 `json:"-"` + Exchange string `json:"exchange"` + Time time.Time `json:"timestamp"` + Interval kline.Interval `json:"interval-size"` + CurrencyPair currency.Pair `json:"pair"` + AssetType asset.Item `json:"asset"` + Reason string `json:"reason"` +} diff --git a/backtester/eventtypes/fill/README.md b/backtester/eventtypes/fill/README.md new file mode 100644 index 00000000..af916b45 --- /dev/null +++ b/backtester/eventtypes/fill/README.md @@ -0,0 +1,57 @@ +# GoCryptoTrader Backtester: Fill package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/fill) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This fill package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Fill package overview + +The Fill Event type contains details the outcome from attempting to make an order. Any slippage or pricing adjustment or fees are part of the fill event. If an order is placed, it is available to access on the event as well as in the compliance manager + +The Fill Event Type is based on `common.EventHandler` and `common.Directioner` while also having the following custom functions +``` +SetAmount(float64) + GetAmount() float64 + GetClosePrice() float64 + GetVolumeAdjustedPrice() float64 + GetSlippageRate() float64 + GetPurchasePrice() float64 + GetExchangeFee() float64 + SetExchangeFee(float64) + GetOrder() *order.Detail +``` + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventtypes/fill/fill.go b/backtester/eventtypes/fill/fill.go new file mode 100644 index 00000000..b6eb2d2f --- /dev/null +++ b/backtester/eventtypes/fill/fill.go @@ -0,0 +1,65 @@ +package fill + +import ( + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// SetDirection sets the direction +func (f *Fill) SetDirection(s order.Side) { + f.Direction = s +} + +// GetDirection returns the direction +func (f *Fill) GetDirection() order.Side { + return f.Direction +} + +// SetAmount sets the amount +func (f *Fill) SetAmount(i float64) { + f.Amount = i +} + +// GetAmount returns the amount +func (f *Fill) GetAmount() float64 { + return f.Amount +} + +// GetClosePrice returns the closing price +func (f *Fill) GetClosePrice() float64 { + return f.ClosePrice +} + +// GetVolumeAdjustedPrice returns the volume adjusted price +func (f *Fill) GetVolumeAdjustedPrice() float64 { + return f.VolumeAdjustedPrice +} + +// GetPurchasePrice returns the purchase price +func (f *Fill) GetPurchasePrice() float64 { + return f.PurchasePrice +} + +// GetTotal returns the total cost +func (f *Fill) GetTotal() float64 { + return f.Total +} + +// GetExchangeFee returns the exchange fee +func (f *Fill) GetExchangeFee() float64 { + return f.ExchangeFee +} + +// SetExchangeFee sets the exchange fee +func (f *Fill) SetExchangeFee(fee float64) { + f.ExchangeFee = fee +} + +// GetOrder returns the order +func (f *Fill) GetOrder() *order.Detail { + return f.Order +} + +// GetSlippageRate returns the slippage rate +func (f *Fill) GetSlippageRate() float64 { + return f.Slippage +} diff --git a/backtester/eventtypes/fill/fill_test.go b/backtester/eventtypes/fill/fill_test.go new file mode 100644 index 00000000..66e03989 --- /dev/null +++ b/backtester/eventtypes/fill/fill_test.go @@ -0,0 +1,82 @@ +package fill + +import ( + "testing" + + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +func TestSetDirection(t *testing.T) { + f := Fill{ + Direction: gctorder.Sell, + } + f.SetDirection(gctorder.Buy) + if f.GetDirection() != gctorder.Buy { + t.Error("expected buy") + } +} + +func TestSetAmount(t *testing.T) { + f := Fill{ + Amount: 1, + } + f.SetAmount(1337) + if f.GetAmount() != 1337 { + t.Error("expected 1337") + } +} + +func TestGetClosePrice(t *testing.T) { + f := Fill{ + ClosePrice: 1337, + } + if f.GetClosePrice() != 1337 { + t.Error("expected 1337") + } +} + +func TestGetVolumeAdjustedPrice(t *testing.T) { + f := Fill{ + VolumeAdjustedPrice: 1337, + } + if f.GetVolumeAdjustedPrice() != 1337 { + t.Error("expected 1337") + } +} + +func TestGetPurchasePrice(t *testing.T) { + f := Fill{ + PurchasePrice: 1337, + } + if f.GetPurchasePrice() != 1337 { + t.Error("expected 1337") + } +} + +func TestSetExchangeFee(t *testing.T) { + f := Fill{ + ExchangeFee: 1, + } + f.SetExchangeFee(1337) + if f.GetExchangeFee() != 1337 { + t.Error("expected 1337") + } +} + +func TestGetOrder(t *testing.T) { + f := Fill{ + Order: &gctorder.Detail{}, + } + if f.GetOrder() == nil { + t.Error("expected not nil") + } +} + +func TestGetSlippageRate(t *testing.T) { + f := Fill{ + Slippage: 1, + } + if f.GetSlippageRate() != 1 { + t.Error("expected 1") + } +} diff --git a/backtester/eventtypes/fill/fill_types.go b/backtester/eventtypes/fill/fill_types.go new file mode 100644 index 00000000..5d098277 --- /dev/null +++ b/backtester/eventtypes/fill/fill_types.go @@ -0,0 +1,38 @@ +package fill + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// Fill is an event that details the events from placing an order +type Fill struct { + event.Base + Direction order.Side `json:"side"` + Amount float64 `json:"amount"` + ClosePrice float64 `json:"close-price"` + VolumeAdjustedPrice float64 `json:"volume-adjusted-price"` + PurchasePrice float64 `json:"purchase-price"` + Total float64 `json:"total"` + ExchangeFee float64 `json:"exchange-fee"` + Slippage float64 `json:"slippage"` + Order *order.Detail `json:"-"` +} + +// Event holds all functions required to handle a fill event +type Event interface { + common.EventHandler + common.Directioner + + SetAmount(float64) + GetAmount() float64 + GetClosePrice() float64 + GetVolumeAdjustedPrice() float64 + GetSlippageRate() float64 + GetPurchasePrice() float64 + GetTotal() float64 + GetExchangeFee() float64 + SetExchangeFee(float64) + GetOrder() *order.Detail +} diff --git a/backtester/eventtypes/kline/README.md b/backtester/eventtypes/kline/README.md new file mode 100644 index 00000000..8aa9df5e --- /dev/null +++ b/backtester/eventtypes/kline/README.md @@ -0,0 +1,44 @@ +# GoCryptoTrader Backtester: Kline package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/kline) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This kline package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Kline package overview + +The Kline event type is used to store the candle data of an individual data event. It can be utilised to understand market conditions at a point in time and make decisions from there + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventtypes/kline/kline.go b/backtester/eventtypes/kline/kline.go new file mode 100644 index 00000000..019775e0 --- /dev/null +++ b/backtester/eventtypes/kline/kline.go @@ -0,0 +1,21 @@ +package kline + +// ClosePrice returns the closing price of a kline +func (k *Kline) ClosePrice() float64 { + return k.Close +} + +// HighPrice returns the high price of a kline +func (k *Kline) HighPrice() float64 { + return k.High +} + +// LowPrice returns the low price of a kline +func (k *Kline) LowPrice() float64 { + return k.Low +} + +// OpenPrice returns the open price of a kline +func (k *Kline) OpenPrice() float64 { + return k.Open +} diff --git a/backtester/eventtypes/kline/kline_test.go b/backtester/eventtypes/kline/kline_test.go new file mode 100644 index 00000000..1788296f --- /dev/null +++ b/backtester/eventtypes/kline/kline_test.go @@ -0,0 +1,41 @@ +package kline + +import ( + "testing" +) + +func TestClose(t *testing.T) { + k := Kline{ + Close: 1337, + } + if k.ClosePrice() != 1337 { + t.Error("expected 1337") + } +} + +func TestHigh(t *testing.T) { + k := Kline{ + High: 1337, + } + if k.HighPrice() != 1337 { + t.Error("expected 1337") + } +} + +func TestLow(t *testing.T) { + k := Kline{ + Low: 1337, + } + if k.LowPrice() != 1337 { + t.Error("expected 1337") + } +} + +func TestOpen(t *testing.T) { + k := Kline{ + Open: 1337, + } + if k.OpenPrice() != 1337 { + t.Error("expected 1337") + } +} diff --git a/backtester/eventtypes/kline/kline_types.go b/backtester/eventtypes/kline/kline_types.go new file mode 100644 index 00000000..5734b579 --- /dev/null +++ b/backtester/eventtypes/kline/kline_types.go @@ -0,0 +1,16 @@ +package kline + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" +) + +// Kline holds kline data and an event to be processed as +// a common.DataEventHandler type +type Kline struct { + event.Base + Open float64 + Close float64 + Low float64 + High float64 + Volume float64 +} diff --git a/backtester/eventtypes/order/README.md b/backtester/eventtypes/order/README.md new file mode 100644 index 00000000..9e4cba54 --- /dev/null +++ b/backtester/eventtypes/order/README.md @@ -0,0 +1,57 @@ +# GoCryptoTrader Backtester: Order package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/order) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This order package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Order package overview + +The Order Event Type is an event type raised after the portfolio manager has passed all its checks and wishes to make an order +It is sent to the Exchange to process and if successful, will raise a Fill Event. + +The Order Event Type is based on `common.EventHandler` and `common.Directioner` while also having the following custom functions +``` + SetAmount(float64) + GetAmount() float64 + IsOrder() bool + GetStatus() order.Status + SetID(id string) + GetID() string + GetLimit() float64 + IsLeveraged() bool +``` + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventtypes/order/order.go b/backtester/eventtypes/order/order.go new file mode 100644 index 00000000..4295da7e --- /dev/null +++ b/backtester/eventtypes/order/order.go @@ -0,0 +1,72 @@ +package order + +import ( + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// IsOrder returns whether the event is an order event +func (o *Order) IsOrder() bool { + return true +} + +// SetDirection sets the side of the order +func (o *Order) SetDirection(s order.Side) { + o.Direction = s +} + +// GetDirection returns the side of the order +func (o *Order) GetDirection() order.Side { + return o.Direction +} + +// SetAmount sets the amount +func (o *Order) SetAmount(i float64) { + o.Amount = i +} + +// GetAmount returns the amount +func (o *Order) GetAmount() float64 { + return o.Amount +} + +// Pair returns the currency pair +func (o *Order) Pair() currency.Pair { + return o.CurrencyPair +} + +// GetStatus returns order status +func (o *Order) GetStatus() order.Status { + return o.Status +} + +// SetID sets the order id +func (o *Order) SetID(id string) { + o.ID = id +} + +// GetID returns the ID +func (o *Order) GetID() string { + return o.ID +} + +// IsLeveraged returns if it is leveraged +func (o *Order) IsLeveraged() bool { + return o.Leverage > 1.0 +} + +// GetLeverage returns leverage rate +func (o *Order) GetLeverage() float64 { + return o.Leverage +} + +// SetLeverage sets leverage +func (o *Order) SetLeverage(l float64) { + o.Leverage = l +} + +// GetFunds returns the amount of funds the portfolio manager +// has allocated to this potential position +func (o *Order) GetFunds() float64 { + return o.Funds +} diff --git a/backtester/eventtypes/order/order_test.go b/backtester/eventtypes/order/order_test.go new file mode 100644 index 00000000..b3294981 --- /dev/null +++ b/backtester/eventtypes/order/order_test.go @@ -0,0 +1,78 @@ +package order + +import ( + "testing" + + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/currency" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +func TestIsOrder(t *testing.T) { + o := Order{} + if !o.IsOrder() { + t.Error("expected true") + } +} + +func TestSetDirection(t *testing.T) { + o := Order{ + Direction: gctorder.Sell, + } + o.SetDirection(gctorder.Buy) + if o.GetDirection() != gctorder.Buy { + t.Error("expected buy") + } +} + +func TestSetAmount(t *testing.T) { + o := Order{ + Amount: 1, + } + o.SetAmount(1337) + if o.GetAmount() != 1337 { + t.Error("expected 1337") + } +} + +func TestPair(t *testing.T) { + o := Order{ + Base: event.Base{ + CurrencyPair: currency.NewPair(currency.BTC, currency.USDT), + }, + } + y := o.CurrencyPair + if y.IsEmpty() { + t.Error("expected btc-usdt") + } +} + +func TestSetID(t *testing.T) { + o := Order{ + ID: "1337", + } + o.SetID("1338") + if o.GetID() != "1338" { + t.Error("expected 1338") + } +} + +func TestLeverage(t *testing.T) { + o := Order{ + Leverage: 1, + } + o.SetLeverage(1337) + if o.GetLeverage() != 1337 || !o.IsLeveraged() { + t.Error("expected leverage") + } +} + +func TestGetFunds(t *testing.T) { + o := Order{ + Funds: 1337, + } + funds := o.GetFunds() + if funds != 1337 { + t.Error("expected 1337") + } +} diff --git a/backtester/eventtypes/order/order_types.go b/backtester/eventtypes/order/order_types.go new file mode 100644 index 00000000..16c48e0c --- /dev/null +++ b/backtester/eventtypes/order/order_types.go @@ -0,0 +1,35 @@ +package order + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// Order contains all details for an order event +type Order struct { + event.Base + ID string + Direction order.Side + Status order.Status + Price float64 + Amount float64 + OrderType order.Type + Leverage float64 + Funds float64 +} + +// Event inherits common event interfaces along with extra functions related to handling orders +type Event interface { + common.EventHandler + common.Directioner + + SetAmount(float64) + GetAmount() float64 + IsOrder() bool + GetStatus() order.Status + SetID(id string) + GetID() string + IsLeveraged() bool + GetFunds() float64 +} diff --git a/backtester/eventtypes/signal/README.md b/backtester/eventtypes/signal/README.md new file mode 100644 index 00000000..440ad9a7 --- /dev/null +++ b/backtester/eventtypes/signal/README.md @@ -0,0 +1,45 @@ +# GoCryptoTrader Backtester: Signal package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/signal) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This signal package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Signal package overview + +The signal event is created as a result of a data event being analysed via a strategy. Typically, there are three types of signal that should be expected `buy`, `sell` and `donothing`. An example of this is demonstrated in the RSI strategy. However, other signals can be raised such as `MissingData`. +The signal event will contain data such as price, the direction as well as the reasoning for the signal decision with the `GetWhy()` function + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/eventtypes/signal/signal.go b/backtester/eventtypes/signal/signal.go new file mode 100644 index 00000000..4e3c757c --- /dev/null +++ b/backtester/eventtypes/signal/signal.go @@ -0,0 +1,36 @@ +package signal + +import ( + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// IsSignal returns whether the event is a signal type +func (s *Signal) IsSignal() bool { + return true +} + +// SetDirection sets the direction +func (s *Signal) SetDirection(st order.Side) { + s.Direction = st +} + +// GetDirection returns the direction +func (s *Signal) GetDirection() order.Side { + return s.Direction +} + +// Pair returns the currency pair +func (s *Signal) Pair() currency.Pair { + return s.CurrencyPair +} + +// GetPrice returns the price +func (s *Signal) GetPrice() float64 { + return s.ClosePrice +} + +// SetPrice sets the price +func (s *Signal) SetPrice(f float64) { + s.ClosePrice = f +} diff --git a/backtester/eventtypes/signal/signal_test.go b/backtester/eventtypes/signal/signal_test.go new file mode 100644 index 00000000..9ed49e55 --- /dev/null +++ b/backtester/eventtypes/signal/signal_test.go @@ -0,0 +1,32 @@ +package signal + +import ( + "testing" + + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +func TestIsSignal(t *testing.T) { + s := Signal{} + if !s.IsSignal() { + t.Error("expected true") + } +} + +func TestSetDirection(t *testing.T) { + s := Signal{Direction: gctorder.Sell} + s.SetDirection(gctorder.Buy) + if s.GetDirection() != gctorder.Buy { + t.Error("expected buy") + } +} + +func TestSetPrice(t *testing.T) { + s := Signal{ + ClosePrice: 1, + } + s.SetPrice(1337) + if s.GetPrice() != 1337 { + t.Error("expected 1337") + } +} diff --git a/backtester/eventtypes/signal/signal_types.go b/backtester/eventtypes/signal/signal_types.go new file mode 100644 index 00000000..49aa8f17 --- /dev/null +++ b/backtester/eventtypes/signal/signal_types.go @@ -0,0 +1,28 @@ +package signal + +import ( + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/eventtypes/event" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// Event handler is used for getting trade signal details +// Example Amount and Price of current candle tick +type Event interface { + common.EventHandler + common.Directioner + + GetPrice() float64 + IsSignal() bool +} + +// Signal contains everything needed for a strategy to raise a signal event +type Signal struct { + event.Base + OpenPrice float64 + HighPrice float64 + LowPrice float64 + ClosePrice float64 + Volume float64 + Direction order.Side +} diff --git a/backtester/main.go b/backtester/main.go new file mode 100644 index 00000000..4c21539a --- /dev/null +++ b/backtester/main.go @@ -0,0 +1,133 @@ +package main + +import ( + "flag" + "fmt" + "os" + "path/filepath" + + "github.com/thrasher-corp/gocryptotrader/backtester/backtest" + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/backtester/config" + gctconfig "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/engine" + gctlog "github.com/thrasher-corp/gocryptotrader/log" + "github.com/thrasher-corp/gocryptotrader/signaler" +) + +func main() { + var configPath, templatePath, reportOutput string + var printLogo, generateReport bool + wd, err := os.Getwd() + if err != nil { + fmt.Printf("Could get working directory. Error: %v.\n", err) + os.Exit(1) + } + flag.StringVar( + &configPath, + "configpath", + filepath.Join( + wd, + "config", + "examples", + "dca-api-candles.strat"), + "the config containing strategy params") + flag.StringVar( + &templatePath, + "templatepath", + filepath.Join( + wd, + "report", + "tpl.gohtml"), + "the report template to use") + flag.BoolVar( + &generateReport, + "generatereport", + true, + "whether to generate the report file") + flag.StringVar( + &reportOutput, + "outputpath", + filepath.Join( + wd, + "results"), + "the path where to output results") + flag.BoolVar( + &printLogo, + "printlogo", + true, + "print out the logo to the command line, projected profits likely won't be affected if disabled") + + flag.Parse() + + var bt *backtest.BackTest + var cfg *config.Config + fmt.Println("reading config...") + cfg, err = config.ReadConfigFromFile(configPath) + if err != nil { + fmt.Printf("Could not read config. Error: %v.\n", err) + os.Exit(1) + } + if printLogo { + fmt.Print(common.ASCIILogo) + } + + path := gctconfig.DefaultFilePath() + if cfg.GoCryptoTraderConfigPath != "" { + path = cfg.GoCryptoTraderConfigPath + } + var bot *engine.Engine + flags := map[string]bool{ + "tickersync": false, + "orderbooksync": false, + "tradesync": false, + "ratelimiter": true, + "ordermanager": false, + } + bot, err = engine.NewFromSettings(&engine.Settings{ + ConfigFile: path, + EnableDryRun: true, + EnableAllPairs: true, + EnableExchangeHTTPRateLimiter: true, + }, flags) + if err != nil { + fmt.Printf("Could not load backtester. Error: %v.\n", err) + os.Exit(-1) + } + bt, err = backtest.NewFromConfig(cfg, templatePath, reportOutput, bot) + if err != nil { + fmt.Printf("Could not setup backtester from config. Error: %v.\n", err) + os.Exit(1) + } + if cfg.DataSettings.LiveData != nil { + go func() { + err = bt.RunLive() + if err != nil { + fmt.Printf("Could not complete live run. Error: %v.\n", err) + os.Exit(-1) + } + }() + interrupt := signaler.WaitForInterrupt() + gctlog.Infof(gctlog.Global, "Captured %v, shutdown requested.\n", interrupt) + bt.Stop() + } else { + err = bt.Run() + if err != nil { + fmt.Printf("Could not complete run. Error: %v.\n", err) + os.Exit(1) + } + } + + err = bt.Statistic.CalculateAllResults() + if err != nil { + gctlog.Error(gctlog.BackTester, err) + os.Exit(1) + } + + if generateReport { + err = bt.Reports.GenerateReport() + if err != nil { + gctlog.Error(gctlog.BackTester, err) + } + } +} diff --git a/backtester/report/README.md b/backtester/report/README.md new file mode 100644 index 00000000..ed2d03d1 --- /dev/null +++ b/backtester/report/README.md @@ -0,0 +1,55 @@ +# GoCryptoTrader Backtester: Report package + + + + +[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader) +[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/backtester/report) +[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) + + +This report package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) + +## Report package overview + +The report package helps generates the output under the `results` folder. + +As the application is run, many statistics such as purchase events are tracked. These events are utilised and enhanced in the report package in order to render an HTML report for easy comparison and historical strategy effectiveness. + +The report utilises the following sweet technologies: +- go templating ([tpl.gohtml](tpl.gohtml)) +- [mdbootstrap](https://mdbootstrap.com/) +- [lightweightcharts](https://github.com/tradingview/lightweight-charts/) by [TradingView](https://www.tradingview.com/) + +Output example: +![example](https://user-images.githubusercontent.com/9261323/105283038-c124be00-5c03-11eb-88af-d67e727a8c16.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package + +## Contribution + +Please feel free to submit any pull requests or suggest any desired features to be added. + +When submitting a PR, please abide by our coding guidelines: + ++ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). ++ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. ++ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md). ++ Pull requests need to be based on and opened against the `master` branch. + +## Donations + + + +If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: + +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/backtester/report/report.go b/backtester/report/report.go new file mode 100644 index 00000000..006996d9 --- /dev/null +++ b/backtester/report/report.go @@ -0,0 +1,181 @@ +package report + +import ( + "fmt" + "html/template" + "os" + "path/filepath" + "strings" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/common" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/log" +) + +// GenerateReport sends final data from statistics to a template +// to create a lovely final report for someone to view +func (d *Data) GenerateReport() error { + log.Info(log.BackTester, "generating report") + err := d.enhanceCandles() + if err != nil { + return err + } + + for i := range d.EnhancedCandles { + if len(d.EnhancedCandles[i].Candles) >= maxChartLimit { + d.EnhancedCandles[i].IsOverLimit = true + d.EnhancedCandles[i].Candles = d.EnhancedCandles[i].Candles[:maxChartLimit] + } + } + + tmpl := template.Must( + template.ParseFiles( + filepath.Join(d.TemplatePath), + ), + ) + var nickName string + if d.Config.Nickname != "" { + nickName = d.Config.Nickname + "-" + } + fileName := fmt.Sprintf( + "%v%v-%v.html", + nickName, + d.Statistics.StrategyName, + time.Now().Format("2006-01-02-15-04-05")) + var f *os.File + f, err = os.Create( + filepath.Join(d.OutputPath, + fileName, + ), + ) + if err != nil { + return err + } + defer func() { + err = f.Close() + if err != nil { + log.Error(log.BackTester, err) + } + }() + + err = tmpl.Execute(f, d) + if err != nil { + return err + } + log.Infof(log.BackTester, "successfully saved report to %v\\%v", d.OutputPath, fileName) + return nil +} + +// AddKlineItem appends a SET of candles for the report to enhance upon +// generation +func (d *Data) AddKlineItem(k *kline.Item) { + d.OriginalCandles = append(d.OriginalCandles, k) +} + +// enhanceCandles will enhance candle data with order information allowing +// report charts to have annotations to highlight buy and sell events +func (d *Data) enhanceCandles() error { + if len(d.OriginalCandles) == 0 { + return errNoCandles + } + if d.Statistics == nil { + return errStatisticsUnset + } + d.Statistics.RiskFreeRate *= 100 + + for intVal := range d.OriginalCandles { + lookup := d.OriginalCandles[intVal] + enhancedKline := DetailedKline{ + Exchange: lookup.Exchange, + Asset: lookup.Asset, + Pair: lookup.Pair, + Interval: lookup.Interval, + Watermark: fmt.Sprintf("%v - %v - %v", strings.Title(lookup.Exchange), lookup.Asset.String(), strings.ToUpper(lookup.Pair.String())), + } + + statsForCandles := + d.Statistics.ExchangeAssetPairStatistics[lookup.Exchange][lookup.Asset][lookup.Pair] + if statsForCandles == nil { + continue + } + + requiresIteration := false + if len(statsForCandles.Events) != len(d.OriginalCandles[intVal].Candles) { + requiresIteration = true + } + for j := range d.OriginalCandles[intVal].Candles { + _, offset := time.Now().Zone() + tt := d.OriginalCandles[intVal].Candles[j].Time.Add(time.Duration(offset) * time.Second) + enhancedCandle := DetailedCandle{ + Time: tt.Unix(), + Open: d.OriginalCandles[intVal].Candles[j].Open, + High: d.OriginalCandles[intVal].Candles[j].High, + Low: d.OriginalCandles[intVal].Candles[j].Low, + Close: d.OriginalCandles[intVal].Candles[j].Close, + Volume: d.OriginalCandles[intVal].Candles[j].Volume, + VolumeColour: "rgba(47, 194, 27, 0.8)", + } + if j != 0 { + if d.OriginalCandles[intVal].Candles[j].Close < d.OriginalCandles[intVal].Candles[j-1].Close { + enhancedCandle.VolumeColour = "rgba(252, 3, 3, 0.8)" + } + } + if !requiresIteration { + if statsForCandles.Events[intVal].SignalEvent.GetTime().Equal(d.OriginalCandles[intVal].Candles[j].Time) && + statsForCandles.Events[intVal].SignalEvent.GetDirection() == common.MissingData && + len(enhancedKline.Candles) > 0 { + enhancedCandle.copyCloseFromPreviousEvent(&enhancedKline) + } + } else { + for k := range statsForCandles.Events { + if statsForCandles.Events[k].SignalEvent.GetTime().Equal(d.OriginalCandles[intVal].Candles[j].Time) && + statsForCandles.Events[k].SignalEvent.GetDirection() == common.MissingData && + len(enhancedKline.Candles) > 0 { + enhancedCandle.copyCloseFromPreviousEvent(&enhancedKline) + } + } + } + for k := range statsForCandles.FinalOrders.Orders { + if statsForCandles.FinalOrders.Orders[k].Detail == nil || + !statsForCandles.FinalOrders.Orders[k].Date.Equal(d.OriginalCandles[intVal].Candles[j].Time) { + continue + } + // an order was placed here, can enhance chart! + enhancedCandle.MadeOrder = true + enhancedCandle.OrderAmount = statsForCandles.FinalOrders.Orders[k].Amount + enhancedCandle.PurchasePrice = statsForCandles.FinalOrders.Orders[k].Price + enhancedCandle.OrderDirection = statsForCandles.FinalOrders.Orders[k].Side + if enhancedCandle.OrderDirection == order.Buy { + enhancedCandle.Colour = "green" + enhancedCandle.Position = "aboveBar" + enhancedCandle.Shape = "arrowDown" + } else if enhancedCandle.OrderDirection == order.Sell { + enhancedCandle.Colour = "red" + enhancedCandle.Position = "belowBar" + enhancedCandle.Shape = "arrowUp" + } + enhancedCandle.Text = enhancedCandle.OrderDirection.String() + break + } + enhancedKline.Candles = append(enhancedKline.Candles, enhancedCandle) + } + d.EnhancedCandles = append(d.EnhancedCandles, enhancedKline) + } + + return nil +} + +func (d *DetailedCandle) copyCloseFromPreviousEvent(enhancedKline *DetailedKline) { + // if the data is missing, ensure that all values just continue the previous candle's close price visually + d.Open = enhancedKline.Candles[len(enhancedKline.Candles)-1].Close + d.High = enhancedKline.Candles[len(enhancedKline.Candles)-1].Close + d.Low = enhancedKline.Candles[len(enhancedKline.Candles)-1].Close + d.Close = enhancedKline.Candles[len(enhancedKline.Candles)-1].Close + + d.Colour = "white" + d.Position = "aboveBar" + d.Shape = "arrowDown" + d.Text = common.MissingData.String() +} diff --git a/backtester/report/report_test.go b/backtester/report/report_test.go new file mode 100644 index 00000000..a631b784 --- /dev/null +++ b/backtester/report/report_test.go @@ -0,0 +1,433 @@ +package report + +import ( + "errors" + "path/filepath" + "testing" + "time" + + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/compliance" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/portfolio/holdings" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics/currencystatistics" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + gctorder "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +const testExchange = "binance" + +func TestGenerateReport(t *testing.T) { + e := testExchange + a := asset.Spot + p := currency.NewPair(currency.BTC, currency.USDT) + + d := Data{ + Config: &config.Config{}, + OutputPath: filepath.Join("..", "results"), + TemplatePath: filepath.Join("tpl.gohtml"), + OriginalCandles: []*gctkline.Item{ + { + Candles: []gctkline.Candle{ + {}, + }, + }, + }, + EnhancedCandles: []DetailedKline{ + { + Exchange: e, + Asset: a, + Pair: p, + Interval: gctkline.OneHour, + Watermark: "Binance - SPOT - BTC-USDT", + Candles: []DetailedCandle{ + { + Time: time.Now().Add(-time.Hour * 5).Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(47, 194, 27, 0.8)", + }, + { + Time: time.Now().Add(-time.Hour * 4).Unix(), + Open: 1332, + High: 1332, + Low: 1330, + Close: 1331, + Volume: 2, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(252, 3, 3, 0.8)", + }, + { + Time: time.Now().Add(-time.Hour * 3).Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(47, 194, 27, 0.8)", + }, + { + Time: time.Now().Add(-time.Hour * 2).Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(252, 3, 3, 0.8)", + }, + { + Time: time.Now().Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + VolumeColour: "rgba(47, 194, 27, 0.8)", + }, + }, + }, + { + Exchange: "Bittrex", + Asset: a, + Pair: currency.NewPair(currency.BTC, currency.USD), + Interval: gctkline.OneDay, + Watermark: "BITTREX - SPOT - BTC-USD - 1d", + Candles: []DetailedCandle{ + { + Time: time.Now().Add(-time.Hour * 5).Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(47, 194, 27, 0.8)", + }, + { + Time: time.Now().Add(-time.Hour * 4).Unix(), + Open: 1332, + High: 1332, + Low: 1330, + Close: 1331, + Volume: 2, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(252, 3, 3, 0.8)", + }, + { + Time: time.Now().Add(-time.Hour * 3).Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(47, 194, 27, 0.8)", + }, + { + Time: time.Now().Add(-time.Hour * 2).Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + MadeOrder: true, + OrderDirection: gctorder.Buy, + OrderAmount: 1337, + Shape: "arrowUp", + Text: "hi", + Position: "aboveBar", + Colour: "green", + PurchasePrice: 50, + VolumeColour: "rgba(252, 3, 3, 0.8)", + }, + { + Time: time.Now().Unix(), + Open: 1337, + High: 1339, + Low: 1336, + Close: 1338, + Volume: 3, + VolumeColour: "rgba(47, 194, 27, 0.8)", + }, + }, + }, + }, + Statistics: &statistics.Statistic{ + StrategyName: "testStrat", + ExchangeAssetPairStatistics: map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic{ + e: { + a: { + p: ¤cystatistics.CurrencyStatistic{ + MaxDrawdown: currencystatistics.Swing{}, + LowestClosePrice: 100, + HighestClosePrice: 200, + MarketMovement: 100, + StrategyMovement: 100, + RiskFreeRate: 1, + CompoundAnnualGrowthRate: 1, + BuyOrders: 1, + SellOrders: 1, + FinalHoldings: holdings.Holding{}, + FinalOrders: compliance.Snapshot{}, + }, + }, + }, + }, + RiskFreeRate: 0.03, + TotalBuyOrders: 1337, + TotalSellOrders: 1330, + TotalOrders: 200, + BiggestDrawdown: &statistics.FinalResultsHolder{ + Exchange: e, + Asset: a, + Pair: p, + MaxDrawdown: currencystatistics.Swing{ + Highest: currencystatistics.Iteration{ + Time: time.Now(), + Price: 1337, + }, + Lowest: currencystatistics.Iteration{ + Time: time.Now(), + Price: 137, + }, + DrawdownPercent: 100, + }, + MarketMovement: 1377, + StrategyMovement: 1377, + }, + BestStrategyResults: &statistics.FinalResultsHolder{ + Exchange: e, + Asset: a, + Pair: p, + MaxDrawdown: currencystatistics.Swing{ + Highest: currencystatistics.Iteration{ + Time: time.Now(), + Price: 1337, + }, + Lowest: currencystatistics.Iteration{ + Time: time.Now(), + Price: 137, + }, + DrawdownPercent: 100, + }, + MarketMovement: 1337, + StrategyMovement: 1337, + }, + BestMarketMovement: &statistics.FinalResultsHolder{ + Exchange: e, + Asset: a, + Pair: p, + MaxDrawdown: currencystatistics.Swing{ + Highest: currencystatistics.Iteration{ + Time: time.Now(), + Price: 1337, + }, + Lowest: currencystatistics.Iteration{ + Time: time.Now(), + Price: 137, + }, + DrawdownPercent: 100, + }, + MarketMovement: 1337, + StrategyMovement: 1337, + }, + }, + } + err := d.GenerateReport() + if err != nil { + t.Error(err) + } +} + +func TestEnhanceCandles(t *testing.T) { + tt := time.Now() + var d Data + err := d.enhanceCandles() + if !errors.Is(err, errNoCandles) { + t.Errorf("expected: %v, received %v", errNoCandles, err) + } + d.AddKlineItem(&gctkline.Item{}) + err = d.enhanceCandles() + if !errors.Is(err, errStatisticsUnset) { + t.Errorf("expected: %v, received %v", errStatisticsUnset, err) + } + d.Statistics = &statistics.Statistic{} + err = d.enhanceCandles() + if err != nil { + t.Error(err) + } + + d.Statistics.ExchangeAssetPairStatistics = make(map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + d.Statistics.ExchangeAssetPairStatistics[testExchange] = make(map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic) + d.Statistics.ExchangeAssetPairStatistics[testExchange][asset.Spot] = make(map[currency.Pair]*currencystatistics.CurrencyStatistic) + d.Statistics.ExchangeAssetPairStatistics[testExchange][asset.Spot][currency.NewPair(currency.BTC, currency.USDT)] = ¤cystatistics.CurrencyStatistic{} + + d.AddKlineItem(&gctkline.Item{ + Exchange: testExchange, + Pair: currency.NewPair(currency.BTC, currency.USDT), + Asset: asset.Spot, + Interval: gctkline.OneDay, + Candles: []gctkline.Candle{ + { + Time: tt, + Open: 1336, + High: 1338, + Low: 1336, + Close: 1337, + Volume: 1337, + }, + }, + }) + err = d.enhanceCandles() + if err != nil { + t.Error(err) + } + + d.AddKlineItem(&gctkline.Item{ + Exchange: testExchange, + Pair: currency.NewPair(currency.BTC, currency.USDT), + Asset: asset.Spot, + Interval: gctkline.OneDay, + Candles: []gctkline.Candle{ + { + Time: tt, + Open: 1336, + High: 1338, + Low: 1336, + Close: 1336, + Volume: 1337, + }, + { + Time: tt, + Open: 1336, + High: 1338, + Low: 1336, + Close: 1335, + Volume: 1337, + }, + }, + }) + + err = d.enhanceCandles() + if err != nil { + t.Error(err) + } + + d.Statistics.ExchangeAssetPairStatistics[testExchange][asset.Spot][currency.NewPair(currency.BTC, currency.USDT)].FinalOrders = compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + ClosePrice: 1335, + VolumeAdjustedPrice: 1337, + SlippageRate: 1, + CostBasis: 1337, + Detail: nil, + }, + }, + Timestamp: tt, + } + err = d.enhanceCandles() + if err != nil { + t.Error(err) + } + + d.Statistics.ExchangeAssetPairStatistics[testExchange][asset.Spot][currency.NewPair(currency.BTC, currency.USDT)].FinalOrders = compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + ClosePrice: 1335, + VolumeAdjustedPrice: 1337, + SlippageRate: 1, + CostBasis: 1337, + Detail: &gctorder.Detail{ + Date: tt, + Side: gctorder.Buy, + }, + }, + }, + Timestamp: tt, + } + err = d.enhanceCandles() + if err != nil { + t.Error(err) + } + + d.Statistics.ExchangeAssetPairStatistics[testExchange][asset.Spot][currency.NewPair(currency.BTC, currency.USDT)].FinalOrders = compliance.Snapshot{ + Orders: []compliance.SnapshotOrder{ + { + ClosePrice: 1335, + VolumeAdjustedPrice: 1337, + SlippageRate: 1, + CostBasis: 1337, + Detail: &gctorder.Detail{ + Date: tt, + Side: gctorder.Sell, + }, + }, + }, + Timestamp: tt, + } + err = d.enhanceCandles() + if err != nil { + t.Error(err) + } + + if len(d.EnhancedCandles) == 0 { + t.Error("expected enhanced candles") + } +} diff --git a/backtester/report/report_types.go b/backtester/report/report_types.go new file mode 100644 index 00000000..72bc7881 --- /dev/null +++ b/backtester/report/report_types.go @@ -0,0 +1,66 @@ +package report + +import ( + "errors" + + "github.com/thrasher-corp/gocryptotrader/backtester/config" + "github.com/thrasher-corp/gocryptotrader/backtester/eventhandlers/statistics" + "github.com/thrasher-corp/gocryptotrader/currency" + "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" + "github.com/thrasher-corp/gocryptotrader/exchanges/order" +) + +// lightweight charts can ony render 1100 candles +const maxChartLimit = 1100 + +var ( + errNoCandles = errors.New("no candles to enhance") + errStatisticsUnset = errors.New("unable to proceed with unset Statistics property") +) + +// Handler contains all functions required to generate statistical reporting for backtesting results +type Handler interface { + GenerateReport() error + AddKlineItem(*kline.Item) +} + +// Data holds all statistical information required to output detailed backtesting results +type Data struct { + OriginalCandles []*kline.Item + EnhancedCandles []DetailedKline + Statistics *statistics.Statistic + Config *config.Config + TemplatePath string + OutputPath string +} + +// DetailedKline enhances kline details for the purpose of rich reporting results +type DetailedKline struct { + IsOverLimit bool + Watermark string + Exchange string + Asset asset.Item + Pair currency.Pair + Interval kline.Interval + Candles []DetailedCandle +} + +// DetailedCandle contains extra details to enable rich reporting results +type DetailedCandle struct { + Time int64 + Open float64 + High float64 + Low float64 + Close float64 + Volume float64 + VolumeColour string + MadeOrder bool + OrderDirection order.Side + OrderAmount float64 + Shape string + Text string + Position string + Colour string + PurchasePrice float64 +} diff --git a/backtester/report/tpl.gohtml b/backtester/report/tpl.gohtml new file mode 100644 index 00000000..60e4d127 --- /dev/null +++ b/backtester/report/tpl.gohtml @@ -0,0 +1,733 @@ + + + + + + + + + + + + + + + + + + + + + + +{{- /*gotype: github.com/thrasher-corp/gocryptotrader/backtester/report.Data*/ -}} +

+ +
+
+
+

{{.Statistics.StrategyName}}

+

{{.Config.Nickname }}

+

Results

+
+
+
+
+

Executive Summary

+
+
+

Goal

+

{{.Config.Goal}}

+
Strategy Description
+

{{.Statistics.StrategyDescription}}

+ {{ if or .Config.DataSettings.APIData .Config.DataSettings.DatabaseData }} + + + {{ if .Config.DataSettings.APIData}} + + + + + + + + + + + + + + {{end}} + {{ if .Config.DataSettings.DatabaseData}} + + + + + + + + + + + + + + {{if .Statistics.WasAnyDataMissing}} + + + + + {{end}} + + {{end}} + + +
Start Date + {{.Config.DataSettings.APIData.StartDate}} +
End Date + {{.Config.DataSettings.APIData.EndDate}} +
Interval + {{.Config.DataSettings.Interval}} +
Start Date + {{.Config.DataSettings.DatabaseData.StartDate}} +
End Date + {{.Config.DataSettings.DatabaseData.EndDate}} +
Interval + {{.Config.DataSettings.Interval}} +
Was any data missing?{{ .Statistics.WasAnyDataMissing}}
+ {{ end }} + {{ if or .Config.DataSettings.CSVData .Config.DataSettings.LiveData }} + + + + + + + +
Interval + {{.Config.DataSettings.Interval}} +
+ {{ end }} + + + + + + + + + + + + + + {{ range $exchange, $unused := .Statistics.ExchangeAssetPairStatistics}} + {{ range $asset, $unused := .}} + {{ range $pair, $unused := .}} + + + + + + + + + + + + {{end}} + {{end}} + {{end}} + +
ExchangeAssetCurrencyStarting fundsResulting fundsDid it make profit?Did it beat the market?Strategy MovementMarket Movement
{{ $exchange}}{{ $asset}}{{ $pair}}${{ printf "%.8f" .FinalHoldings.InitialFunds }} {{.FinalHoldings.Pair.Quote}}${{ printf "%.8f" .FinalHoldings.TotalValue }} {{ .FinalHoldings.Pair.Quote}}{{ gt .FinalHoldings.TotalValue .FinalHoldings.InitialFunds }} {{ gt .StrategyMovement .MarketMovement }}{{ printf "%.2f" .StrategyMovement }}%{{ printf "%.2f" .MarketMovement }}%
+
+ +
+
+
+
+
+

Config

+
+
+
+
+
+
+

Strategy Settings

+
+
+ + + + + + + + + + + + + + + +
Strategy name{{.Config.StrategySettings.Name}}
Is multi currency{{.Config.StrategySettings.SimultaneousSignalProcessing}}
Custom settings{{.Config.StrategySettings.CustomSettings}}
+
+
+
+
+
+
+

Currency Settings

+
+
+ + + + + + + + + + + + + + + + + + + + {{ range .Config.CurrencySettings}} + + + + + + + + + + + + + + + + + + {{end}} + +
Exchange NameAssetCurrency BaseCurrency QuoteInitial FundsBuy side Min AmountBuy side Max AmountBuy side Max TotalSell side Min AmountSell side Max AmountSell side Max TotalMin Slippage PercentMax Slippage PercentTaker FeeMaximum Holdings Ratio
{{.ExchangeName}}{{.Asset}}{{.Base}}{{.Quote}}{{ printf "$%.8f" .InitialFunds}} {{.Quote}}{{.BuySide.MinimumSize}} {{.Base}}{{.BuySide.MaximumSize}} {{.Base}}${{printf "%.8f" .BuySide.MaximumTotal}} {{.Quote}}{{.SellSide.MinimumSize}} {{.Base}}{{.SellSide.MaximumSize}} {{.Base}}${{printf "%.8f" .SellSide.MaximumTotal}} {{.Quote}}{{.MinimumSlippagePercent}}%{{.MaximumSlippagePercent}}%{{.TakerFee}}{{.MaximumHoldingsRatio}}
+
+
+
+
+
+
+

Portfolio Settings

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Can Use LeverageMax Leverage RateMax Orders With Leverage RatioBuy side Min AmountBuy side Max AmountBuy side Max TotalSell side Min AmountSell side Max AmountSell side Max Total
{{.Config.PortfolioSettings.Leverage.CanUseLeverage}}{{.Config.PortfolioSettings.Leverage.MaximumLeverageRate}}{{.Config.PortfolioSettings.Leverage.MaximumOrdersWithLeverageRatio}}{{.Config.PortfolioSettings.BuySide.MinimumSize}}{{.Config.PortfolioSettings.BuySide.MaximumSize}}${{printf "%.8f" .Config.PortfolioSettings.BuySide.MaximumTotal}}{{.Config.PortfolioSettings.SellSide.MinimumSize}}{{.Config.PortfolioSettings.SellSide.MaximumSize}}${{printf "%.8f" .Config.PortfolioSettings.SellSide.MaximumTotal}}
+
+
+
+
+
+
+

Statistics Settings

+
+
+ + + + + + + + + +
Risk-Free Rate
{{.Config.StatisticSettings.RiskFreeRate}}
+
+
+
+
+
+
+

Charts

+
+
+ {{ range .EnhancedCandles}} + {{ if .IsOverLimit}} +

Note: Number of candles processed is higher than chart can render. Only showing the first 1,100

+ {{end}} +
+

{{.Exchange}} {{.Asset}} {{.Pair}}

+ +
+ {{end}} +
+
+
+
+
+
+

Statistics

+
+
+ + + + + + + + + + + + + + + + + + + + + + + {{ if .Statistics.BiggestDrawdown}} + + + + + {{end}} + {{ if .Statistics.BestMarketMovement}} + + + + + {{end}} + {{ if .Statistics.BestStrategyResults}} + + + + + {{ end}} + +
Strategy Name{{.Statistics.StrategyName}}
Risk Free Rate{{.Statistics.RiskFreeRate}}%
Total Buy Orders{{.Statistics.TotalBuyOrders}}
Total Sell Orders{{.Statistics.TotalSellOrders}}
Total Orders{{.Statistics.TotalOrders}}
Biggest DrawdownStart: {{.Statistics.BiggestDrawdown.MaxDrawdown.Highest.Time }} End: {{.Statistics.BiggestDrawdown.MaxDrawdown.Lowest.Time }} Drop: {{.Statistics.BiggestDrawdown.MaxDrawdown.DrawdownPercent}}%
Best performing market movement{{.Statistics.BestMarketMovement.Exchange }} {{.Statistics.BestMarketMovement.Asset}} {{.Statistics.BestMarketMovement.Pair}} {{.Statistics.BestMarketMovement.MarketMovement}}%
Best performing strategy movement{{.Statistics.BestStrategyResults.Exchange }} {{.Statistics.BestStrategyResults.Asset}} {{.Statistics.BestStrategyResults.Pair}} {{.Statistics.BestStrategyResults.StrategyMovement}}%
+
+
+ {{ range $exchange, $unused := .Statistics.ExchangeAssetPairStatistics}} + {{ range $asset, $unused := .}} + {{ range $pair, $val := .}} +
+
+

Statistics for {{$exchange}} {{ $asset}} {{ $pair}}

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ if gt $val.MaxDrawdown.Highest.Price 0.0 }} + + + + + {{ end }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Initial Funds${{printf "%.8f" $val.FinalHoldings.InitialFunds}} {{$val.FinalHoldings.Pair.Quote}}
Buy Orders{{$val.BuyOrders}}
Buy Value${{printf "%.8f" $val.FinalHoldings.BoughtValue}} {{$val.FinalHoldings.Pair.Quote}}
Buy Amount{{printf "%.8f" $val.FinalHoldings.BoughtAmount}} {{$val.FinalHoldings.Pair.Base}}
Sell Orders{{$val.SellOrders}}
Sell Value${{printf "%.8f" $val.FinalHoldings.SoldValue}} {{$val.FinalHoldings.Pair.Quote}}
Sell Amount{{printf "%.8f" $val.FinalHoldings.SoldAmount}} {{$val.FinalHoldings.Pair.Base}}
Total Orders{{$val.TotalOrders}}
Biggest DrawdownStart: {{ $val.MaxDrawdown.Highest.Time }} End: {{ $val.MaxDrawdown.Lowest.Time }} Drop: {{printf "%.2f" $val.MaxDrawdown.DrawdownPercent}}%
Starting Close Price${{printf "%.8f" $val.StartingClosePrice}} {{$val.FinalHoldings.Pair.Quote}}
Ending Close Price${{printf "%.8f" $val.EndingClosePrice}} {{ $val.FinalHoldings.Pair.Quote }}
Lowest Close Price${{printf "%.8f" $val.LowestClosePrice}} {{$val.FinalHoldings.Pair.Quote}}
Highest Close Price${{printf "%.8f" $val.HighestClosePrice}} {{ $val.FinalHoldings.Pair.Quote}}
Highest Committed Funds${{printf "%.8f" $val.HighestCommittedFunds.Value}} at {{ $val.HighestCommittedFunds.Time}}
Market Movement{{printf "%.2f" $val.MarketMovement}}%
Strategy Movement{{ printf "%.2f" $val.StrategyMovement}}%
Did it beat the market?{{ gt .StrategyMovement $val.MarketMovement}}
Total Value Lost to Volume Sizing${{printf "%.8f" $val.FinalHoldings.TotalValueLostToVolumeSizing}} {{$val.FinalHoldings.Pair.Quote}}
Total Value Lost to Slippage${{printf "%.8f" $val.FinalHoldings.TotalValueLostToSlippage}} {{ $val.FinalHoldings.Pair.Quote }}
Total Value Lost${{printf "%.8f" $val.FinalHoldings.TotalValueLost}} {{$val.FinalHoldings.Pair.Quote}}
Total Fees${{printf "%.8f" $val.FinalHoldings.TotalFees}} {{ $val.FinalHoldings.Pair.Quote }}
Final Funds${{printf "%.8f" $val.FinalHoldings.RemainingFunds}} {{ $val.FinalHoldings.Pair.Quote}}
Final Holdings{{printf "%.8f" $val.FinalHoldings.PositionsSize}} {{$val.FinalHoldings.Pair.Base}}
Final Holdings Value${{printf "%.8f" $val.FinalHoldings.PositionsValue}} {{ $val.FinalHoldings.Pair.Quote }}
Total Value${{printf "%.8f" $val.FinalHoldings.TotalValue}} {{ $val.FinalHoldings.Pair.Quote}}
+ Rates + + + + + + + + + + + +
Risk Free Rate{{$val.RiskFreeRate}}%
Compound Annual Growth Rate{{$val.CompoundAnnualGrowthRate}}%
+ {{if $val.ShowMissingDataWarning}} +

Missing data was detected during this backtesting run
+ Ratio calculations will be skewed

+ {{end}} + Arithmetic Ratios + + + + + + + + + + + + + + + + + + + +
Sharpe Ratio{{$val.ArithmeticRatios.SharpeRatio}}
Sortino Ratio{{$val.ArithmeticRatios.SortinoRatio}}
Information Ratio{{$val.ArithmeticRatios.InformationRatio}}
Calmar Ratio{{$val.ArithmeticRatios.CalmarRatio}}
+ Geometric Ratios + + + + + + + + + + + + + + + + + + + +
Sharpe Ratio{{$val.GeometricRatios.SharpeRatio}}
Sortino Ratio{{$val.GeometricRatios.SortinoRatio}}
Information Ratio{{$val.GeometricRatios.InformationRatio}}
Calmar Ratio{{$val.GeometricRatios.CalmarRatio}}
+
+
+ {{end}} + {{end}} + {{end}} +
+
+
+
+

Orders

+
+
+ + {{ range $exchange, $unused := .Statistics.ExchangeAssetPairStatistics}} + {{ range $asset, $unused := .}} + {{ range $pair, $val := .}} +
+

{{$exchange}} {{$asset}} {{ $pair }}

+
+
+ + + + + + + + + + + + + {{range $val.FinalOrders.Orders}} + + + + + + + + + + + {{end}} + +
DateClose PriceSidePurchase PriceSlippage RateAmountFeesCost Basis
{{ .Detail.Date }}${{ .ClosePrice}} {{$pair.Quote}}{{ .Detail.Side }}${{ .Detail.Price }} {{$pair.Quote}}{{ .SlippageRate }}%{{printf "%.8f" .Detail.Amount }} {{$pair.Base}}${{printf "%.8f" .Detail.Fee }} {{$pair.Quote}}${{printf "%.8f" .CostBasis }} {{$pair.Quote}}
+
+ {{end}} + {{end}} + {{end}} +
+
+
+
+
+
+

Events

+
+
+ {{ range $exchange, $unused := .Statistics.ExchangeAssetPairStatistics}} + {{ range $asset, $unused :=.}} + {{ range $pair, $data := .}} +
+

{{$exchange}} {{$asset}} {{ $pair }}

+
+
+ + + + + + + + + + {{range $ev := $data.Events}} + + {{ if ne $ev.FillEvent nil }} + + + + + {{ else if ne $ev.SignalEvent nil}} + + + + + {{ end }} + + + {{end}} + +
DatePriceActionWhyCommitted Funds
{{$ev.FillEvent.GetTime}}${{$ev.FillEvent.GetClosePrice}} {{$pair.Quote}}{{$ev.FillEvent.GetDirection}}{{$ev.FillEvent.GetReason}}{{$ev.SignalEvent.GetTime}}${{ printf "%f" $ev.SignalEvent.Price}} {{$pair.Quote}}{{$ev.SignalEvent.GetDirection}}{{$ev.SignalEvent.GetReason}}${{printf "%.8f" $ev.Holdings.CommittedFunds}} {{$pair.Quote}}
+
+ {{end}} + {{end}} + {{end}} +
+
+
+
+ + diff --git a/backtester/results/.gitignore b/backtester/results/.gitignore new file mode 100644 index 00000000..86d0cb27 --- /dev/null +++ b/backtester/results/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_backtest_readme.tmpl b/cmd/documentation/backtester_templates/backtester_backtest_readme.tmpl new file mode 100644 index 00000000..99ed0d48 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_backtest_readme.tmpl @@ -0,0 +1,22 @@ +{{define "backtester backtest" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The backtest package is the most important package of the GoCryptoTrader backtester. It is the engine which combines all elements. +It is responsible for the following functionality +- Loading settings from a provided config file +- Retrieving data +- Loading the data into assessable chunks +- Analysing the data via the `handleEvent` function +- Looping through all data +- Outputting results into a report + + +A flow of the application is as follows: +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_common_readme.tmpl b/cmd/documentation/backtester_templates/backtester_common_readme.tmpl new file mode 100644 index 00000000..28a1b0cc --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_common_readme.tmpl @@ -0,0 +1,10 @@ +{{define "backtester common" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +Common contains some basic data types which are used throughout. + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_config_configbuilder_readme.tmpl b/cmd/documentation/backtester_templates/backtester_config_configbuilder_readme.tmpl new file mode 100644 index 00000000..a553b8d1 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_config_configbuilder_readme.tmpl @@ -0,0 +1,19 @@ +{{define "backtester config configbuilder" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +### What does the config builder do? +The config builder runs you through the process of creating a strategy config (`.strat`) file. Configs can also be generated via test code under `config_test.go`. +Once the config is created, when running the backtester, you can reference it via `go run . -configPath=(path-to-strat-file)` + +### How do I run it? +`go run .` + +### Anything else? +The config builder will ask you all the necessary questions required to create a config file. If there is anything confusing, feel free to ask a question in our Slack group or open an issue! + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_config_examples_readme.tmpl b/cmd/documentation/backtester_templates/backtester_config_examples_readme.tmpl new file mode 100644 index 00000000..ca9cd6dc --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_config_examples_readme.tmpl @@ -0,0 +1,18 @@ +{{define "backtester config examples" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +Current Config Examples: + +| Config | Description | +| --- | ------ | +| dollar-cost-average.strat | A simple dollar cost average strategy which makes a purchase on every candle. | +| dollar-cost-average-live.strat | Using the same dollar cost average strategy, but runs the analysis against live candles | +| dollar-cost-average-multi-currency-assessment.strat | This strategy will assess multiple currencies in the one `OnSignals` function, however, it also just simply makes a purchase on every candle | +| dollar-cost-average-multiple-currencies.strat | This runs the same strategy against multiple currencies independently | +| rsi.strat | Runs a strategy using rsi figures to make buy or sell orders based on market figures | + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_config_readme.tmpl b/cmd/documentation/backtester_templates/backtester_config_readme.tmpl new file mode 100644 index 00000000..e2c2d97b --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_config_readme.tmpl @@ -0,0 +1,133 @@ +{{define "backtester config" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +### What does the config package do? +The config package contains a set of structs which allow for the customisation of the GoCryptoTrader Backtester when running. +The GoCryptoTrader Backtester runs from reading config files (`.strat` files by default under `/examples`). + + +### What does Simultaneous Processing mean? +GoCryptoTrader Backtester config files may contain multiple `ExchangeSettings` which defined exchange, asset and currency pairs to iterate through a period of time. + +If there are multiple entries to `ExchangeSettings` and SimultaneousProcessing is disabled, then each individual exchange, asset and currency pair candle event is evaluated individually and does not know about other exchange, asset and currency pair data events. It is a way to test a singular strategy against multiple assets simultaneously. But it isn't defined as Simultaneous Processing +Simultaneous Signal Processing is a setting which allows multiple `ExchangeSettings` data events for a candle event to be considered simultaneously. This means that you can check if the price of BTC-USDT is 5% greater on Binance than it is on Kraken and choose to make signal a BUY event for Kraken and not Binance. + +It allows for complex strategical decisions to be made when you consider the scope of the entire market at a given time, rather than in a vacuum when SimultaneousSignalProcessing is disabled. + +### How do I customise the GoCryptoTrader Backtester? +See below for a set of tables and fields, expected values and what they can do + +#### Config + +| Key | Description | +| --- | ------| +| Nickname | A nickname for the specific config. When running multiple variants of the same strategy, use the nickname to help differentiate between runs | +| Goal | A description of what you would hope the outcome to be. When verifying output, you can review and confirm whether the strategy met that goal | +| CurrencySettings | Currency settings is an array of settings for each individual currency you wish to run the strategy against. | +| StrategySettings | Select which strategy to run, what custom settings to load and whether the strategy can assess multiple currencies at once to make more in-depth decisions | +| PortfolioSettings | Contains a list of global rules for the portfolio manager. CurrencySettings contain their own rules on things like how big a position is allowable, the portfolio manager rules are the same, but override any individual currency's settings | +| StatisticSettings | Contains settings that impact statistics calculation. Such as the risk-free rate for the sharpe ratio | +| GoCryptoTraderConfigPath | The filepath for the location of GoCryptoTrader's config path. The Backtester utilises settings from GoCryptoTrader. If unset, will utilise the default filepath via `config.DefaultFilePath`, implemented [here](/config/config.go#L1460) | + +#### Currency Settings + +| Key | Description | Example | +| --- | ------- | ----- | +| ExchangeName | The exchange to load. See [here](https://github.com/thrasher-corp/gocryptotrader/blob/master/README.md) for a list of supported exchanges | `Binance` | +| Asset | The asset type. Typically, this will be `spot`, however, see [this package](https://github.com/thrasher-corp/gocryptotrader/blob/master/exchanges/asset/asset.go) for the various asset types GoCryptoTrader supports| `spot` | +| Base | The base of a currency | `BTC` | +| Quote | The quote of a currency | `USDT` | +| InitialFunds | The funds that the GoCryptoTraderBacktester has for the specific currency | `10000` | +| Leverage | This struct defines the leverage rules that this specific currency setting must abide by | `1` | +| BuySide | This struct defines the buying side rules this specific currency setting must abide by such as maximum purchase amount | - | +| SellSide | This struct defines the selling side rules this specific currency setting must abide by such as maximum selling amount | - | +| MinimumSlippagePercent | Is the lower bounds in a random number generated that make purchases more expensive, or sell events less valuable. If this value is 90, then the most a price can be affected is 10% | `90` | +| MaximumSlippagePercent | Is the upper bounds in a random number generated that make purchases more expensive, or sell events less valuable. If this value is 99, then the least a price can be affected is 1%. Set both upper and lower to 100 to have no randomness applied to purchase events | `100` | +| MakerFee | The fee to use when sizing and purchasing currency | `0.001` | +| TakerFee | Unused fee for when an order is placed in the orderbook, rather than taken from the orderbook | `0.002` | +| MaximumHoldingsRatio | When multiple currency settings are used, you may set a maximum holdings ratio to prevent having too large a stake in a single currency | `0.5` | + +#### Strategy Settings + +| Key | Description | Example | +| --- | ------- | --- | +| Name | The strategy to use. | `rsi` | +| UsesSimultaneousProcessing | This denotes whether multiple currencies are processed simultaneously with the strategy function `OnSimultaneousSignals`. Eg If you have multiple CurrencySettings and only wish to purchase BTC-USDT when XRP-DOGE is 1337, this setting is useful as you can analyse both signal events to output a purchase call for BTC. | `true` | +| CustomSettings | This is a map where you can enter custom settings for a strategy. The RSI strategy allows for customisation of the upper, lower and length variables to allow you to change them from 70, 30 and 14 respectively to 69, 36, 12 | `"custom-settings": { "rsi-high": 70, "rsi-low": 30, "rsi-period": 14 } ` | + +#### PortfolioSettings + +| Key | Description | +| --- | ------- | +| Leverage | This struct defines the leverage rules that this specific currency setting must abide by | +| BuySide | This struct defines the buying side rules this specific currency setting must abide by such as maximum purchase amount | +| SellSide | This struct defines the selling side rules this specific currency setting must abide by such as maximum selling amount | + +#### StatisticsSettings + +| Key | Description | Example | +| --- | ----------- | ------- | +| RiskFreeRate | The risk free rate used in the calculation of sharpe and sortino ratios | `0.03` | + +#### APIData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `trade` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| StartDate | The start date to retrieve data | `2021-01-23T11:00:00+11:00` | +| EndDate | The end date to retrieve data | `2021-01-24T11:00:00+11:00` | +| InclusiveEndDate | When enabled, the end date's candle is included in the results. ie `2021-01-24T11:00:00+11:00` with a one hour candle, the final candle will be `2021-01-24T11:00:00+11:00` to `2021-01-24T12:00:00+11:00` | `false` | + +#### CSVData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `candle` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| FullPath | The file to load | `/data/exchangelist.csv` | + +#### DatabaseData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `trade` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| StartDate | The start date to retrieve data | `2021-01-23T11:00:00+11:00` | +| EndDate | The end date to retrieve data | `2021-01-24T11:00:00+11:00` | +| ConfigOverride | Override GoCryptoTrader's config database data with custom settings | `true` | +| InclusiveEndDate | When enabled, the end date's candle is included in the results. ie `2021-01-24T11:00:00+11:00` with a one hour candle, the final candle will be `2021-01-24T11:00:00+11:00` to `2021-01-24T12:00:00+11:00` | `false` | + +#### LiveData + +| Key | Description | Example | +| --- | ----------- | ------- | +| DataType | Choose whether `candle` or `trade` data is used. If trades are used, they will be converted to candles | `candle` | +| Interval | The candle interval in `time.Duration` format eg set as`15000000000` for a value of `time.Second * 15` | `15000000000` | +| APIKeyOverride | Will set the GoCryptoTrader exchange to use the following API Key | `1234` | +| APISecretOverride | Will set the GoCryptoTrader exchange to use the following API Secret | `5678` | +| APIClientIDOverride | Will set the GoCryptoTrader exchange to use the following API Client ID | `9012` | +| API2FAOverride | Will set the GoCryptoTrader exchange to use the following 2FA seed | `hello-moto` | +| RealOrders | Whether to place real orders. You really should never consider using this. Ever ever. | `true` | + +##### Leverage Settings + +| Key | Description | Example | +| --- | ----------- | ------- | +| CanUseLeverage | Allows the use of leverage | `false` | +| MaximumOrdersWithLeverageRatio | If the ratio of leveraged orders for a currency exceeds this, the order cannot be placed | `0.5` | +| MaximumLeverageRate | Orders cannot be placed with leverage over this amount | `100` | + +##### Buy/Sell Settings + +| Key | Description | Example | +| --- | ----------- | ------- | +| MinimumSize | If the order's quantity is below this, the order cannot be placed | `0.1` | +| MaximumSize | If the order's quantity is over this amount, it cannot be placed and will be reduced to the maximum amount | `10` | +| MaximumTotal | If the order's price * amount exceeds this number, the order cannot be placed and will be reduced to this figure | `1337` | + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_data_kline_api_readme.tmpl b/cmd/documentation/backtester_templates/backtester_data_kline_api_readme.tmpl new file mode 100644 index 00000000..79349ba1 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_data_kline_api_readme.tmpl @@ -0,0 +1,13 @@ +{{define "backtester data kline api" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +This package is responsible for the loading of kline data via the API. It can retrieve candle data or trade data which is converted into candle data. +This package uses existing GoCryptoTrader exchange implementations. + +See individual exchange implementations [here](/exchanges) and the interface used [here](/exchanges/interfaces.go) + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_data_kline_csv_readme.tmpl b/cmd/documentation/backtester_templates/backtester_data_kline_csv_readme.tmpl new file mode 100644 index 00000000..32ae309d --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_data_kline_csv_readme.tmpl @@ -0,0 +1,35 @@ +{{define "backtester data kline csv" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +This package is responsible for the loading of kline data via a CSV file. It can retrieve candle data or trade data which is converted into candle data. + +### CSV Format +#### Candle based CSV + +| Field | Example | +| ----- | -------- | +| Timestamp | 1546300800 | +| Volume | 3 | +| Open | 1335 | +| High | 1338 | +| Low | 1336 | +| Close | 1337 | + +Additionally, you can view an example under `./testdata/binance_BTCUSDT_24h_2019_01_01_2020_01_01.csv` + +#### Trade based CSV + +| Field | Example | +| ----- | -------- | +| Timestamp | 1546300800 | +| Price | 1337 | +| Amount | 420.69 | + +Additionally, you can view an example under `./testdata/binance_BTCUSDT_24h-trades_2020_11_16.csv` + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_data_kline_database_readme.tmpl b/cmd/documentation/backtester_templates/backtester_data_kline_database_readme.tmpl new file mode 100644 index 00000000..8506838e --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_data_kline_database_readme.tmpl @@ -0,0 +1,19 @@ +{{define "backtester data kline database" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +This package is responsible for the loading of kline data via a user's existing GoCryptoTrader database. It can load existing data from the `candles` and `trades` tables. +For more information on the GoCryptoTrader database, read [this readme](/database/README.md). +Ensure that your database has data and has been seeded with exchanges. For more information on this, please see [this readme](/cmd/dbseed/README.md). + +### Database credentials +#### Defaults +The default database will be loaded from your GoCryptoTrader config. See [this](/database) for database configuration and implementation. + +#### Overriding the GoCryptoTrader config +Database configuration details can be overridden in the `.strat` config file to allow other sources to be used and not rely on existing GoCryptoTrader configuration. See [this readme](/backtester/config/README.md) for details on config customisation + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_data_kline_live_readme.tmpl b/cmd/documentation/backtester_templates/backtester_data_kline_live_readme.tmpl new file mode 100644 index 00000000..87200f8e --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_data_kline_live_readme.tmpl @@ -0,0 +1,13 @@ +{{define "backtester data kline live" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +This package will retrieve data for the backtester via continuous requests to live endpoints + +## Important notice +Live trading is not fully implemented and you should never consider setting `RealOrders` to `true` in a config. *Past performance is no guarantee of future results* + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_data_kline_readme.tmpl b/cmd/documentation/backtester_templates/backtester_data_kline_readme.tmpl new file mode 100644 index 00000000..e7b54583 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_data_kline_readme.tmpl @@ -0,0 +1,15 @@ +{{define "backtester data kline" -}} + {{template "backtester-header" .}} +## {{.CapitalName}} package overview + +When loading data for the kline, it can come from two sources: candles or trades. In the config they are represented as `common.CandleStr` or `common.TradeStr` respectively. + +Candle data represents the opening, closing, highest, lowest prices of a given timespan (interval) along with the volume (amount traded) during that same period. You can read more about candles [here](https://www.investopedia.com/terms/c/candlestick.asp). This data is utilised throughout the GoCryptoTrader Backtester in order to make informed strategic decisions. + +Trade data represents the raw trading data on an exchange. Every buy or sell action for the given currency. When trading data is used for the GoCryptoTrader Backtester, it is converted into candle data at the interval you specify. This allows for custom candle intervals not provided by an exchange's API and thus has a greater amount of flexibility in backtesting strategies. + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_data_readme.tmpl b/cmd/documentation/backtester_templates/backtester_data_readme.tmpl new file mode 100644 index 00000000..e00f2e84 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_data_readme.tmpl @@ -0,0 +1,16 @@ +{{define "backtester data" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The data package defines and implements a base version of the `Streamer` interface which is part of the `Handler` interface. These interfaces allow for the translation of data into individual intervals to be accessed and assessed as part of the `backtest` package. +This is a base implementation, the more proper implementation that is used throughout the backtester is under `./kline` + +This can also be used to implement other means to load data for the backtester to process, however kline is currently the only supported method. + + + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_eventholder_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_eventholder_readme.tmpl new file mode 100644 index 00000000..d270b56b --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_eventholder_readme.tmpl @@ -0,0 +1,12 @@ +{{define "backtester eventhandlers eventholder" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The event holder is a simple interface implementation which allows the backtester to iterate over the event queue. +The event holder is based on the `EventHolder` interface and is implemented by `Holder`. +It is used by `backtest.Backtester` and it accepts appending any struct which implements the `common.EventHandler` interface, eg `order.Order` + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_readme.tmpl new file mode 100644 index 00000000..901233f3 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_readme.tmpl @@ -0,0 +1,24 @@ +{{define "backtester eventhandlers exchange" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The exchange eventhandler is responsible for calling the `engine` package's `ordermanager` to place either a fake, or real order on the exchange via API. + +The following steps are taken for the `ExecuteOrder` function: + +- Calculate slippage. If the order is a sell order, it will reduce the price by a random percentage between the two values. If it is a buy order, it will raise the price by a random percentage between the two values + - If `RealOrders` is set to `false`: + - It will estimate the slippage based on what is in the config file under `min-slippage-percent` and `max-slippage-percent`. + - It will be sized within the constraints of the current candles OHLCV values + - It will generate the exchange fee based on what is stored in the config for the exchange asset currency pair + - If `RealOrders` is set to `true`, it will use the latest orderbook data to calculate slippage by simulating the order + - Place the order with the engine order manager + - If `RealOrders` is set to `false` it will submit the order with no calls to the exchange's API, use no API credentials and it will always pass + - If `RealOrders` is set to `true` it will submit the order via the exchange's API and if successful, will be stored in the order manager + - If an order is successfully placed, a snapshot of all existing orders in the run will be captured and store for statistical purposes + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_slippage_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_slippage_readme.tmpl new file mode 100644 index 00000000..e7e74a6a --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_exchange_slippage_readme.tmpl @@ -0,0 +1,20 @@ +{{define "backtester eventhandlers exchange slippage" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +Slippage refers to the difference between the expected price of a trade and the price at which the trade is executed. Slippage is used here to simulate what would occur if trading was live as no perfect conditions exist for placing orders. +Slippage is calculated in two ways in the GoCryptoTrader Backtester + +### If `RealOrders` is `true` +- The orderbook is frequently requested during live cycle candle retrieval +- When the order is being calculated in the `ExecuteOrder` eventhandler, it will use the orderbook to simulate placing the order and adjust the order price + +### If `RealOrders` is `false` +- The `min-slippage-percent` and `max-slippage-percent` values for the specific exchange, asset and currency pair will be used as bounds to simulate an orderbook using a random number + - If it is a buy order, it will raise the price by a random percentage between the two values + - If the order is a sell order, it will reduce the price by a random percentage between the two values + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_compliance_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_compliance_readme.tmpl new file mode 100644 index 00000000..b7f2d898 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_compliance_readme.tmpl @@ -0,0 +1,11 @@ +{{define "backtester eventhandlers portfolio compliance" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The compliance manager is used to store all events at each time interval. When debugging the backtester or wanting to audit backtesting results, you can inspect every single action that has occurred during the backtesting run + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_holdings_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_holdings_readme.tmpl new file mode 100644 index 00000000..ea123ba8 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_holdings_readme.tmpl @@ -0,0 +1,12 @@ +{{define "backtester eventhandlers portfolio holdings" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +Holdings are used to calculate the holdings at any given time for a given exchange, asset, currency pair. If an order is placed, funds are removed from funding and placed under assets. +Every data event will update and calculate holdings value based on the new price. This will allow for statistics to be easily calculated at the end of a backtesting run + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_readme.tmpl new file mode 100644 index 00000000..a391ca23 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_readme.tmpl @@ -0,0 +1,34 @@ +{{define "backtester eventhandlers portfolio" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The portfolio is one of the most critical packages in the GoCryptoTrader Backtester. It is responsible for making sure that all orders, simulated or otherwise are within all defined risk and sizing rules defined in the config. +The portfolio receives three kinds of events to be processed: `OnSignal`, `OnFill` and `Update` + +The following steps are taken for the `OnSignal` function: +- Retrieve previous iteration's holdings data +- If a buy order signal is received, ensure there are enough funds +- If a sell order signal is received, ensure there are any holdings to sell +- If any other direction, return +- The portfolio manager will then size the order according to the exchange asset currency pair's settings along with the portfolio manager's own sizing rules + - In the event that the order is to large, the sizing package will reduce the order until it fits that limit, inclusive of fees. + - When an order is sized under the limits, an order event cannot be raised an no order will be submitted by the exchange + - The portfolio manager's sizing rules override any CurrencySettings' rules if the sizing is outside the portfolio manager's +- The portfolio manager will then assess the risk of the order, it will compare existing holdings and ensures that if an order is placed, it will not go beyond risk rules as defined in the config +- If the risk is too high, the order signal will be changed to `CouldNotBuy`, `CouldNotSell` or `DoNothing` +- If the order is deemed appropriate, the order event will be returned and appended to the event queue for the exchange event handler to run and place the order + +The following steps are taken for the `OnFill` function: +- Previous holdings are retrieved and amended with new order information. + - The stats for the exchange asset currency pair will be updated to reflect the order and pricing +- The order will be added to the compliance manager for analysis in future events or the statistics package + +The following steps are taken for the `Update` function: +- The `Update` function is called when orders are not placed, this allows for the portfolio manager to still keep track of pricing and holding statistics, while not needing to process any orders + + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_risk_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_risk_readme.tmpl new file mode 100644 index 00000000..b88bc1ac --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_risk_readme.tmpl @@ -0,0 +1,14 @@ +{{define "backtester eventhandlers portfolio risk" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The risk manager is responsible for ensuring that no order can be made if it is deemed too risky. +Risk is currently defined by ensuring that orders cannot have too much leverage for the individual order, overall with all orders in the portfolio as well as whether there are too many orders for an individual currency + +See config package [readme](/backtester/config/README.md) to view the risk related fields to customise + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_size_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_size_readme.tmpl new file mode 100644 index 00000000..9eeda17c --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_portfolio_size_readme.tmpl @@ -0,0 +1,14 @@ +{{define "backtester eventhandlers portfolio size" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The sizing package ensures that all potential orders raised are within both the CurrencySettings limits as well as the portfolio manager's limits. +- In the event that the order is to large, the sizing package will reduce the order until it fits that limit, inclusive of fees. +- When an order is sized under the limits, an order event cannot be raised an no order will be submitted by the exchange +- The portfolio manager's sizing rules override any CurrencySettings' rules if the sizing is outside the portfolio manager's + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_readme.tmpl new file mode 100644 index 00000000..c919c4c1 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_readme.tmpl @@ -0,0 +1,13 @@ +{{define "backtester eventhandlers" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} overview + +Event handlers are responsible for taking in an event, analysing its contents and outputting another event to be handled. An individual candle is turned into a data event which handled via the strategy event handler. The strategy handler outputs a signal event, which the portfolio eventhandler will size and risk analyse before raising an order event. The event is then sent to the portfolio manager to determine whether there is appropriate funding, adequate risk and proper order sizing before raising an order event. The order event is taken to the exchange handler which will place the order and create a fill event. +Below is an overview of how event handlers are used +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_currencystatistics_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_currencystatistics_readme.tmpl new file mode 100644 index 00000000..e6420149 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_currencystatistics_readme.tmpl @@ -0,0 +1,39 @@ +{{define "backtester eventhandlers statistics currencystatistics" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +Currency Statistics is an important package to verify the effectiveness of your strategies. +It can calculate the following: +- Calmar ratio +- Information ratio +- Sharpe ratio +- Sortino ratio +- CAGR +- Drawdowns, both the biggest and longest +- Whether the strategy outperformed the market +- If the strategy made a profit + +## Ratios + +| Ratio | Description | A good range | +| ----- | ----------- | ------------ | +| Calmar ratio | It is a function of the fund's average compounded annual rate of return versus its maximum drawdown. The higher the Calmar ratio, the better it performed on a risk-adjusted basis during the given time frame, which is mostly commonly set at 36 months. | 3.0 to 5.0 | +| Information ratio| It is a measurement of portfolio returns beyond the returns of a benchmark, usually an index, compared to the volatility of those returns. The ratio is often used as a measure of a portfolio manager's level of skill and ability to generate excess returns relative to a benchmark | 0.40-0.60. Any positive number means that it has beaten the benchmark | +| Sharpe ratio | The Sharpe Ratio is a financial metric often used by investors when assessing the performance of investment management products and professionals. It consists of taking the excess return of the portfolio, relative to the risk-free rate, and dividing it by the standard deviation of the portfolio's excess returns | Any Sharpe ratio greater than 1.0 is good. Higher than 2.0 is very good. 3.0 or higher is excellent. Under 1.0 is sub-optimal | +| Sortino ratio | The Sortino ratio measures the risk-adjusted return of an investment asset, portfolio, or strategy. It is a modification of the Sharpe ratio but penalizes only those returns falling below a user-specified target or required rate of return, while the Sharpe ratio penalizes both upside and downside volatility equally. | The higher the better, but > 2 is considered good. | +| Compound annual growth rate | Compound annual growth rate is the rate of return that would be required for an investment to grow from its beginning balance to its ending balance, assuming the profits were reinvested at the end of each year of the investment’s lifespan | Any positive number | + +## Arithmetic or versus geometric? +Both! We calculate ratios where an average is required using both types. The reasoning for using either is debated by finance and mathematicians. [This](https://www.investopedia.com/ask/answers/06/geometricmean.asp) is a good breakdown of both, but here is an extra simple table + +| Average type | A reason to use it | +| ------------ | ------------------ | +| Arithmetic | The arithmetic mean is the average of a sum of numbers, which reflects the central tendency of the position of the numbers | +| Geometric | The geometric mean differs from the arithmetic average, or arithmetic mean, in how it is calculated because it takes into account the compounding that occurs from period to period. Because of this, investors usually consider the geometric mean a more accurate measure of returns than the arithmetic mean. | + + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_readme.tmpl new file mode 100644 index 00000000..43f4ea31 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_statistics_readme.tmpl @@ -0,0 +1,13 @@ +{{define "backtester eventhandlers statistics" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The statistics package is used for storing all relevant data over the course of a GoCryptoTrader Backtesting run. All types of events are tracked by exchange, asset and currency pair. +When multiple currencies are included in your strategy, the statistics package will be able to calculate which exchange asset currency pair has performed the best, along with the biggest drop downs in the market. + + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_base_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_base_readme.tmpl new file mode 100644 index 00000000..5c353d43 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_base_readme.tmpl @@ -0,0 +1,11 @@ +{{define "backtester eventhandlers strategies base" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The strategy base file has basic implementations of the `strategies.Handler` interface. Add any functions that can be used across all strategies here. + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_dollarcostaverage_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_dollarcostaverage_readme.tmpl new file mode 100644 index 00000000..01b44ab1 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_dollarcostaverage_readme.tmpl @@ -0,0 +1,13 @@ +{{define "backtester eventhandlers strategies dollarcostaverage" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The dollar cost average is a strategy which is designed to purchase on _every_ data candle. Unless data is missing, all output signals will be to buy. +This strategy supports simultaneous signal processing, aka `config.StrategySettings.SimultaneousSignalProcessing` set to true will use the function `OnSignals(d []data.Handler, p portfolio.Handler) ([]signal.Event, error)`. This function, like the basic `OnSignal` function, will signal to buy on every iteration. +This strategy does not support customisation + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_readme.tmpl new file mode 100644 index 00000000..23a4de97 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_readme.tmpl @@ -0,0 +1,27 @@ +{{define "backtester eventhandlers strategies" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +Strategies are programmed instruction sets which act upon pricing data. After data has been loaded into the GoCryptoTrader, each tick is passed through your loaded strategy and is analysed in either the `OnSignal` function or the `OnSignals` function. + +### Creating strategies +The level customisation allowed in a strategy is extensive. They are required to be written in Golang. +The strategy must adhere to the interface `strategies.Handler` by implementing the function signature `OnSignal(d data.Handler, _ portfolio.Handler) (signal.Event, error)`. The `data.Handler` allows you to access the current pricing information as well as all previous intervals. You can use this to feed any Technical Analysis package to create strategies based on market movements such as RSI (see `./strategies/rsi/rsi.go`). Strategies can also access the portfolio manager on signal(s) which allows analysis of existing holdings value, current orders and positions of other currencies in order to make complex decisions. +When outputting the `signal.Event`, you are not dictating the price of an order, but rather signalling to the portfolio manager what ideally should occur. These options are to buy, sell or do nothing. Additional signals are to flag missing data, handled via checking `d.HasDataAtTime(d.Latest().GetTime()` to prevent any issues from occurring down the line. +Additionally, you can utilise the `AppendWhy()` function to help understand what went into make a signalling decision when reviewing the results. + +### What does Simultaneous Signal Processing mean? +GoCryptoTrader Backtester config files may contain multiple `ExchangeSettings` which defined exchange, asset and currency pairs to iterate through a period of time. + +If there are multiple entries to `ExchangeSettings` and SimultaneousProcessing is disabled, then each individual exchange, asset and currency pair candle event is evaluated individually and does not know about other exchange, asset and currency pair data events. It is a way to test a singular strategy against multiple assets simultaneously. But it isn't defined as Simultaneous Processing +Simultaneous Signal Processing is a setting which allows multiple `ExchangeSettings` data events for a candle event to be considered simultaneously. This means that you can check if the price of BTC-USDT is 5% greater on Binance than it is on Kraken and choose to make signal a BUY event for Kraken and not Binance. + +It allows for complex strategical decisions to be made when you consider the scope of the entire market at a given time, rather than in a vacuum when SimultaneousSignalProcessing is disabled. + +### Loading strategies +Each strategy has a unique name and is to be added to the function `getStrategies()` in order to be recognised. + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_rsi_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_rsi_readme.tmpl new file mode 100644 index 00000000..579f574f --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventhandlers_strategies_rsi_readme.tmpl @@ -0,0 +1,18 @@ +{{define "backtester eventhandlers strategies rsi" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The RSI strategy utilises [the gct-ta RSI package](https://github.com/thrasher-corp/gct-ta) to analyse market signals and output buy or sell signals based on the RSI output. +This strategy does not support `SimultaneousSignalProcessing` aka [use-simultaneous-signal-processing](/backtester/config/README.md). +This strategy does support strategy customisation in the following ways: + +| Field | Description | Example | +| --- | ------- | --- | +|rsi-high| The upper bounds of RSI that when met, will trigger a Sell signal | 70 | +|rsi-low| The lower bounds of RSI that when met, will trigger a Buy signal | 30 | +|rsi-period| The consecutive candle periods used in order to generate a value. All values less than this number cannot output a buy or sell signal | 14 | + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventtypes_event_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventtypes_event_readme.tmpl new file mode 100644 index 00000000..09a5a25b --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventtypes_event_readme.tmpl @@ -0,0 +1,11 @@ +{{define "backtester eventtypes event" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The event event type is an important base for all other events. It allows for consistent information to be used across all events in order to track and make decisions. Any information that is shared between events should be added to this struct + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventtypes_fill_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventtypes_fill_readme.tmpl new file mode 100644 index 00000000..ddbe93ef --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventtypes_fill_readme.tmpl @@ -0,0 +1,23 @@ +{{define "backtester eventtypes fill" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The Fill Event type contains details the outcome from attempting to make an order. Any slippage or pricing adjustment or fees are part of the fill event. If an order is placed, it is available to access on the event as well as in the compliance manager + +The Fill Event Type is based on `common.EventHandler` and `common.Directioner` while also having the following custom functions +``` +SetAmount(float64) + GetAmount() float64 + GetClosePrice() float64 + GetVolumeAdjustedPrice() float64 + GetSlippageRate() float64 + GetPurchasePrice() float64 + GetExchangeFee() float64 + SetExchangeFee(float64) + GetOrder() *order.Detail +``` + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventtypes_kline_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventtypes_kline_readme.tmpl new file mode 100644 index 00000000..ccb89324 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventtypes_kline_readme.tmpl @@ -0,0 +1,10 @@ +{{define "backtester eventtypes kline" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The Kline event type is used to store the candle data of an individual data event. It can be utilised to understand market conditions at a point in time and make decisions from there + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventtypes_order_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventtypes_order_readme.tmpl new file mode 100644 index 00000000..c9523297 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventtypes_order_readme.tmpl @@ -0,0 +1,23 @@ +{{define "backtester eventtypes order" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The Order Event Type is an event type raised after the portfolio manager has passed all its checks and wishes to make an order +It is sent to the Exchange to process and if successful, will raise a Fill Event. + +The Order Event Type is based on `common.EventHandler` and `common.Directioner` while also having the following custom functions +``` + SetAmount(float64) + GetAmount() float64 + IsOrder() bool + GetStatus() order.Status + SetID(id string) + GetID() string + GetLimit() float64 + IsLeveraged() bool +``` + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventtypes_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventtypes_readme.tmpl new file mode 100644 index 00000000..49ccd690 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventtypes_readme.tmpl @@ -0,0 +1,13 @@ +{{define "backtester eventtypes" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} overview + +Event types are created after retrieving candle data. An individual candle is turned into a data event which is sent to the strategy for analysis. The event is then sent to the portfolio manager to determine whether there is appropriate funding, adequate risk and proper order sizing before raising an order event. The order event is taken to the exchange handler which will place the order and create a fill event. The fill event is used to update the portfolios individual holdings for analysis and decision making. +Below is an overview of how events are used +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_eventtypes_signal_readme.tmpl b/cmd/documentation/backtester_templates/backtester_eventtypes_signal_readme.tmpl new file mode 100644 index 00000000..41615f37 --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_eventtypes_signal_readme.tmpl @@ -0,0 +1,11 @@ +{{define "backtester eventtypes signal" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The signal event is created as a result of a data event being analysed via a strategy. Typically, there are three types of signal that should be expected `buy`, `sell` and `donothing`. An example of this is demonstrated in the RSI strategy. However, other signals can be raised such as `MissingData`. +The signal event will contain data such as price, the direction as well as the reasoning for the signal decision with the `GetWhy()` function + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/backtester_templates/backtester_readme.tmpl b/cmd/documentation/backtester_templates/backtester_readme.tmpl new file mode 100644 index 00000000..d6bb3ada --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_readme.tmpl @@ -0,0 +1,72 @@ +{{define "backtester" -}} +{{template "backtester-header" .}} + +# GoCryptoTrader Backtester +An event-driven backtesting tool to test and iterate trading strategies using historical or custom data. + +## Features +- Works with all GoCryptoTrader exchanges that support trade/candle retrieval. See [candle readme](/docs/OHLCV.md) and [trade readme](/exchanges/trade/README.md) for supported exchanges +- CSV data import +- Database data import +- Proof of concept live data running +- Can run strategies against multiple cryptocurrencies +- Can run strategies that can assess multiple currencies simultaneously to make complex decisions +- Dollar cost strategy implementation +- RSI strategy implementation +- Rules customisation via config `.strat` files +- Strategy customisation without requiring recompilation. For example, customising RSI high, low and length values via config `.strat` files. +- Report generation +- Portfolio manager to help size orders based on config rules, risk and candle volume +- Order manager to place orders with customisable slippage estimator +- Helpful statistics to help determine whether a strategy was effective +- Compliance manager to keep snapshots of every transaction and their changes at every interval + +## How does it work? +- The application will load a `.strat` config file as specified at runtime +- The `.strat` config file will contain + - Start & end dates + - The strategy to run + - The candle interval + - Where the data is to be sourced ([API](/backtester/data/kline/api/README.md), [CSV](/backtester/data/kline/csv/README.md), [database](/backtester/data/kline/database/README.md), [live](/backtester/data/kline/live/README.md)) + - Whether to use trade or candle data ([readme](/backtester/data/kline/README.md)) + - A nickname for the strategy (to help differentiate between runs/configs using the same strategy) + - The currency/currencies to use + - The exchange(s) to run against + - See [readme](/backtester/config/README.md) for a breakdown of all config features +- The GoCryptoTrader Backtester will retrieve the data specified in the config ([readme](/backtester/backtest/README.md)) +- The data is converted into candles and each candle is streamed as a data event. +- The data event is analysed by the strategy which will output a purchasing signal such as `BUY`, `SELL` or `DONOTHING` ([readme](/backtester/eventtypes/signal/README.md)) +- The purchase signal is then processed by the portfolio manager ([readme](/backtester/eventhandlers/portfolio/README.md)) which will size the order ([readme](/backtester/eventhandlers/portfolio/size/README.md)) and assess risk ([readme](/backtester/eventhandlers/portfolio/risk/README.md)) before sending it to the exchange +- The exchange order event handler will size to the candle data and run a slippage estimator ([readme](/backtester/eventhandlers/exchange/slippage/README.md)) and place the order ([readme](/backtester/eventhandlers/exchange/README.md)) +- Upon an order being placed, the order is snapshot for analysis in both the statistics package ([readme](/backtester/eventhandlers/statistics/README.md)) and the report package ([readme](/backtester/report/README.md)) + + +# Cool story, how do I use it? +To run the application using the provided dollar cost average strategy, simply run `go run .` from `gocryptotrader/backtester`. An output of the results will be put in the `results` folder. + +# How do I create my own config? +There is a config generating helper application under `/backtester/config/configbuilder` to help you create a `.strat` file. Read more about it [here](/backtester/config/configbuilder/README.md). There are also a number of tests under `/config/config_test.go` which generate configs into the `examples` folder, which if you have code knowledge, can write your own configs programmatically. + +# How do I create my own strategy? +Creating strategies requires programming skills. [Here](/backtester/eventhandlers/strategies/README.md) is a readme on the subject. After reading the readmes, please review the strategies [here](/backtester/eventhandlers/strategies/) to gain an understanding on how to write your own. + +# How does it work technically? +- The readmes linked in the "How does it work" covers the main parts of the application. + - If you are still unsure, please raise an issue, ask a question in our Slack or open a pull request +- Here is an overview +![workflow](https://user-images.githubusercontent.com/9261323/104982257-61d97900-5a5e-11eb-930e-3b431d6e6bab.png) + + +# Important notes +- This application is not considered production ready and you may experience issues + - If you encounter any issues, you can raise them in our Slack channel or via Github issues +- **Past performance is no guarantee of future results** +- While an experimental feature, it is **not** recommended to **ever** use live trading and real orders +- **Past performance is no guarantee of future results** + + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} diff --git a/cmd/documentation/backtester_templates/backtester_report_readme.tmpl b/cmd/documentation/backtester_templates/backtester_report_readme.tmpl new file mode 100644 index 00000000..1d48955e --- /dev/null +++ b/cmd/documentation/backtester_templates/backtester_report_readme.tmpl @@ -0,0 +1,21 @@ +{{define "backtester report" -}} +{{template "backtester-header" .}} +## {{.CapitalName}} package overview + +The report package helps generates the output under the `results` folder. + +As the application is run, many statistics such as purchase events are tracked. These events are utilised and enhanced in the report package in order to render an HTML report for easy comparison and historical strategy effectiveness. + +The report utilises the following sweet technologies: +- go templating ([tpl.gohtml](tpl.gohtml)) +- [mdbootstrap](https://mdbootstrap.com/) +- [lightweightcharts](https://github.com/tradingview/lightweight-charts/) by [TradingView](https://www.tradingview.com/) + +Output example: +![example](https://user-images.githubusercontent.com/9261323/105283038-c124be00-5c03-11eb-88af-d67e727a8c16.png) + + +### Please click GoDocs chevron above to view current GoDoc information for this package +{{template "contributions"}} +{{template "donations" .}} +{{end}} \ No newline at end of file diff --git a/cmd/documentation/documentation.go b/cmd/documentation/documentation.go index b6330d66..8ba4c610 100644 --- a/cmd/documentation/documentation.go +++ b/cmd/documentation/documentation.go @@ -236,6 +236,16 @@ func main() { URL: "https://github.com/merkeld", Contributions: 1, }, + { + Login: "CodeLingoTeam", + URL: "https://github.com/CodeLingoTeam", + Contributions: 1, + }, + { + Login: "Daanikus", + URL: "https://github.com/Daanikus", + Contributions: 1, + }, }...) if verbose { @@ -423,7 +433,8 @@ func GetPackageName(name string, capital bool) string { newStrings := strings.Split(name, " ") var i int if len(newStrings) > 1 { - i = 1 + // retrieve the latest spacing to define the most childish package name + i = len(newStrings) - 1 } if capital { return strings.Title(newStrings[i]) diff --git a/cmd/documentation/root_templates/root_readme.tmpl b/cmd/documentation/root_templates/root_readme.tmpl index 4955b195..fdc6b08c 100644 --- a/cmd/documentation/root_templates/root_readme.tmpl +++ b/cmd/documentation/root_templates/root_readme.tmpl @@ -78,6 +78,7 @@ However, we welcome pull requests for any exchange which does not match this cri + OHLCV/Candle retrieval support. See [OHLCV](/docs/OHLCV.md). + Scripting support. See [gctscript](/gctscript/README.md). + Recent and historic trade processing. See [trades](/exchanges/trade/README.md). ++ Backtesting application. An event-driven backtesting tool to test and iterate trading strategies using historical or custom data. See [backtester](/backtester/README.md). + WebGUI (discontinued). ## Planned Features diff --git a/cmd/documentation/sub_templates/backtesting-header.tmpl b/cmd/documentation/sub_templates/backtesting-header.tmpl new file mode 100644 index 00000000..ff128898 --- /dev/null +++ b/cmd/documentation/sub_templates/backtesting-header.tmpl @@ -0,0 +1,15 @@ +{{define "backtester-header" -}} +# GoCryptoTrader Backtester: {{.CapitalName}} package + + + +{{template "status" .NameURL}} + +This {{.Name}} package is part of the GoCryptoTrader codebase. + +## This is still in active development + +You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader). + +Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) +{{end}} diff --git a/cmd/exchange_template/exchange_template.go b/cmd/exchange_template/exchange_template.go index 927b8487..38c832fe 100644 --- a/cmd/exchange_template/exchange_template.go +++ b/cmd/exchange_template/exchange_template.go @@ -90,8 +90,17 @@ func main() { WS: websocketSupport, FIX: fixSupport, } + exchangeDirectory := filepath.Join(targetPath, exch.Name) + configTestFile := config.GetConfig() - if err = makeExchange(&exch); err != nil { + var newConfig *config.ExchangeConfig + newConfig, err = makeExchange(exchangeDirectory, configTestFile, &exch) + if err != nil { + log.Fatal(err) + } + + err = saveConfig(exchangeDirectory, configTestFile, newConfig) + if err != nil { log.Fatal(err) } @@ -113,34 +122,32 @@ func checkExchangeName(exchName string) error { return nil } -func makeExchange(exch *exchange) error { - configTestFile := config.GetConfig() +func makeExchange(exchangeDirectory string, configTestFile *config.Config, exch *exchange) (*config.ExchangeConfig, error) { err := configTestFile.LoadConfig(exchangeConfigPath, true) if err != nil { - return err + return nil, err } // NOTE need to nullify encrypt configuration _, err = configTestFile.GetExchangeConfig(exch.Name) if err == nil { - return errors.New("exchange already exists") + return nil, errors.New("exchange already exists") } - exchangeDirectory := filepath.Join(targetPath, exch.Name) _, err = os.Stat(exchangeDirectory) if !os.IsNotExist(err) { - return errors.New("directory already exists") + return nil, errors.New("directory already exists") } err = os.MkdirAll(exchangeDirectory, 0770) if err != nil { - return err + return nil, err } fmt.Printf("Output directory: %s\n", exchangeDirectory) exch.CapitalName = strings.Title(exch.Name) exch.Variable = exch.Name[0:2] - newExchConfig := config.ExchangeConfig{} + newExchConfig := &config.ExchangeConfig{} newExchConfig.Name = exch.CapitalName newExchConfig.Enabled = true newExchConfig.API.Credentials.Key = "Key" @@ -196,7 +203,7 @@ func makeExchange(exch *exchange) error { var tmpl *template.Template tmpl, err = template.New(outputFiles[x].Name).ParseFiles(outputFiles[x].TemplateFile) if err != nil { - return fmt.Errorf("%s template error: %s", outputFiles[x].Name, err) + return nil, fmt.Errorf("%s template error: %s", outputFiles[x].Name, err) } filename := outputFiles[x].Filename @@ -209,16 +216,20 @@ func makeExchange(exch *exchange) error { var f *os.File f, err = os.OpenFile(outputFile, os.O_WRONLY, 0770) if err != nil { - return err + return nil, err } if err = tmpl.Execute(f, exch); err != nil { f.Close() - return err + return nil, err } f.Close() } + return newExchConfig, nil +} + +func saveConfig(exchangeDirectory string, configTestFile *config.Config, newExchConfig *config.ExchangeConfig) error { cmd := exec.Command("go", "fmt") cmd.Dir = exchangeDirectory out, err := cmd.Output() @@ -226,7 +237,7 @@ func makeExchange(exch *exchange) error { return fmt.Errorf("unable to go fmt. output: %s err: %s", out, err) } - configTestFile.Exchanges = append(configTestFile.Exchanges, newExchConfig) + configTestFile.Exchanges = append(configTestFile.Exchanges, *newExchConfig) err = configTestFile.SaveConfigToFile(exchangeConfigPath) if err != nil { return err @@ -238,7 +249,6 @@ func makeExchange(exch *exchange) error { if err != nil { return fmt.Errorf("unable to go test. output: %s err: %s", out, err) } - return nil } diff --git a/cmd/exchange_template/exchange_template_test.go b/cmd/exchange_template/exchange_template_test.go index d6fe84b3..40b8b66d 100644 --- a/cmd/exchange_template/exchange_template_test.go +++ b/cmd/exchange_template/exchange_template_test.go @@ -48,27 +48,19 @@ func TestNewExchange(t *testing.T) { testExchangeName := "testexch" testExchangeDir := filepath.Join(targetPath, testExchangeName) - if err := makeExchange(&exchange{ - Name: testExchangeName, - REST: true, - WS: true, - }); err != nil { + _, err := makeExchange( + testExchangeDir, + config.GetConfig(), + &exchange{ + Name: testExchangeName, + REST: true, + WS: true, + }) + if err != nil { t.Error(err) } if err := os.RemoveAll(testExchangeDir); err != nil { t.Errorf("unable to remove dir: %s, manual removal required", err) } - - cfg := config.GetConfig() - if err := cfg.LoadConfig(exchangeConfigPath, true); err != nil { - t.Fatal(err) - } - if success := cfg.RemoveExchange(testExchangeName); !success { - t.Fatalf("unable to remove exchange config for %s, manual removal required\n", - testExchangeName) - } - if err := cfg.SaveConfigToFile(exchangeConfigPath); err != nil { - t.Fatal(err) - } } diff --git a/common/math/math.go b/common/math/math.go index 406a86bf..5d9f13cf 100644 --- a/common/math/math.go +++ b/common/math/math.go @@ -1,6 +1,19 @@ package math -import "math" +import ( + "errors" + "math" +) + +var ( + errZeroValue = errors.New("cannot calculate average of no values") + errNegativeValueOutOfRange = errors.New("received negative number less than -1") + errGeometricNegative = errors.New("cannot calculate a geometric mean with negative values") + errCalmarHighest = errors.New("cannot calculate calmar ratio with highest price of 0") + errCAGRNoIntervals = errors.New("cannot calculate CAGR with no intervals") + errCAGRZeroOpenValue = errors.New("cannot calculate CAGR with an open value of 0") + errInformationBadLength = errors.New("benchmark rates length does not match returns rates") +) // CalculateAmountWithFee returns a calculated fee included amount on fee func CalculateAmountWithFee(amount, fee float64) float64 { @@ -34,3 +47,194 @@ func RoundFloat(x float64, prec int) float64 { pow := math.Pow(10, float64(prec)) return math.Round(x*pow) / pow } + +// CompoundAnnualGrowthRate Calculates CAGR. +// Using years, intervals per year would be 1 and number of intervals would be the number of years +// Using days, intervals per year would be 365 and number of intervals would be the number of days +func CompoundAnnualGrowthRate(openValue, closeValue, intervalsPerYear, numberOfIntervals float64) (float64, error) { + if numberOfIntervals == 0 { + return 0, errCAGRNoIntervals + } + if openValue == 0 { + return 0, errCAGRZeroOpenValue + } + k := math.Pow(closeValue/openValue, intervalsPerYear/numberOfIntervals) - 1 + return k * 100, nil +} + +// CalmarRatio is a function of the average compounded annual rate of return versus its maximum drawdown. +// The higher the Calmar ratio, the better it performed on a risk-adjusted basis during the given time frame, which is mostly commonly set at 36 months +func CalmarRatio(highestPrice, lowestPrice, average, riskFreeRateForPeriod float64) (float64, error) { + if highestPrice == 0 { + return 0, errCalmarHighest + } + drawdownDiff := (highestPrice - lowestPrice) / highestPrice + if drawdownDiff == 0 { + return 0, nil + } + return (average - riskFreeRateForPeriod) / drawdownDiff, nil +} + +// InformationRatio The information ratio (IR) is a measurement of portfolio returns beyond the returns of a benchmark, +// usually an index, compared to the volatility of those returns. +// The benchmark used is typically an index that represents the market or a particular sector or industry. +func InformationRatio(returnsRates, benchmarkRates []float64, averageValues, averageComparison float64) (float64, error) { + if len(benchmarkRates) != len(returnsRates) { + return 0, errInformationBadLength + } + var diffs []float64 + for i := range returnsRates { + diffs = append(diffs, returnsRates[i]-benchmarkRates[i]) + } + stdDev, err := PopulationStandardDeviation(diffs) + if err != nil { + return 0, err + } + if stdDev == 0 { + return 0, nil + } + return (averageValues - averageComparison) / stdDev, nil +} + +// PopulationStandardDeviation calculates standard deviation using population based calculation +func PopulationStandardDeviation(values []float64) (float64, error) { + if len(values) < 2 { + return 0, nil + } + valAvg, err := ArithmeticMean(values) + if err != nil { + return 0, err + } + diffs := make([]float64, len(values)) + for x := range values { + diffs[x] = math.Pow(values[x]-valAvg, 2) + } + var diffAvg float64 + diffAvg, err = ArithmeticMean(diffs) + if err != nil { + return 0, err + } + return math.Sqrt(diffAvg), nil +} + +// SampleStandardDeviation standard deviation is a statistic that +// measures the dispersion of a dataset relative to its mean and +// is calculated as the square root of the variance +func SampleStandardDeviation(values []float64) (float64, error) { + if len(values) < 2 { + return 0, nil + } + mean, err := ArithmeticMean(values) + if err != nil { + return 0, err + } + var superMean []float64 + var combined float64 + for i := range values { + result := math.Pow(values[i]-mean, 2) + superMean = append(superMean, result) + combined += result + } + avg := combined / (float64(len(superMean)) - 1) + return math.Sqrt(avg), nil +} + +// GeometricMean is an average which indicates the central tendency or +// typical value of a set of numbers by using the product of their values +// The geometric average can only process positive numbers +func GeometricMean(values []float64) (float64, error) { + if len(values) == 0 { + return 0, errZeroValue + } + product := 1.0 + for i := range values { + if values[i] <= 0 { + // cannot use negative or zero values in geometric calculation + return 0, errGeometricNegative + } + product *= values[i] + } + geometricPower := math.Pow(product, 1/float64(len(values))) + return geometricPower, nil +} + +// FinancialGeometricMean is a modified geometric average to assess +// the negative returns of investments. It accepts It adds +1 to each +// This does impact the final figures as it is modifying values +// It is still ultimately calculating a geometric average +// which should only be compared to other financial geometric averages +func FinancialGeometricMean(values []float64) (float64, error) { + if len(values) == 0 { + return 0, errZeroValue + } + product := 1.0 + for i := range values { + if values[i] < -1 { + // cannot lose more than 100%, figures are incorrect + // losing exactly 100% will return a 0 value, but is not an error + return 0, errNegativeValueOutOfRange + } + // as we cannot have negative or zero value geometric numbers + // adding a 1 to the percentage movements allows for differentiation between + // negative numbers (eg -0.1 translates to 0.9) and positive numbers (eg 0.1 becomes 1.1) + modVal := values[i] + 1 + product *= modVal + } + geometricPower := math.Pow(product, 1/float64(len(values))) + if geometricPower > 0 { + // we minus 1 because we manipulated the values to be non-zero/negative + geometricPower-- + } + return geometricPower, nil +} + +// ArithmeticMean is the basic form of calculating an average. +// Divide the sum of all values by the length of values +func ArithmeticMean(values []float64) (float64, error) { + if len(values) == 0 { + return 0, errZeroValue + } + var sumOfValues float64 + for x := range values { + sumOfValues += values[x] + } + return sumOfValues / float64(len(values)), nil +} + +// SortinoRatio returns sortino ratio of backtest compared to risk-free +func SortinoRatio(movementPerCandle []float64, riskFreeRatePerInterval, average float64) (float64, error) { + totalIntervals := float64(len(movementPerCandle)) + if totalIntervals == 0 { + return 0, errZeroValue + } + totalNegativeResultsSquared := 0.0 + for x := range movementPerCandle { + if movementPerCandle[x]-riskFreeRatePerInterval < 0 { + totalNegativeResultsSquared += math.Pow(movementPerCandle[x]-riskFreeRatePerInterval, 2) + } + } + averageDownsideDeviation := math.Sqrt(totalNegativeResultsSquared / float64(len(movementPerCandle))) + + return (average - riskFreeRatePerInterval) / averageDownsideDeviation, nil +} + +// SharpeRatio returns sharpe ratio of backtest compared to risk-free +func SharpeRatio(movementPerCandle []float64, riskFreeRatePerInterval, average float64) (float64, error) { + totalIntervals := float64(len(movementPerCandle)) + if totalIntervals == 0 { + return 0, errZeroValue + } + var excessReturns []float64 + for i := range movementPerCandle { + excessReturns = append(excessReturns, movementPerCandle[i]-riskFreeRatePerInterval) + } + standardDeviation, err := PopulationStandardDeviation(excessReturns) + if err != nil { + return 0, err + } + if standardDeviation == 0 { + return 0, nil + } + + return (average - riskFreeRatePerInterval) / standardDeviation, nil +} diff --git a/common/math/math_test.go b/common/math/math_test.go index f0e4fd17..7bbd4e1a 100644 --- a/common/math/math_test.go +++ b/common/math/math_test.go @@ -1,6 +1,10 @@ package math -import "testing" +import ( + "errors" + "math" + "testing" +) func TestCalculateFee(t *testing.T) { t.Parallel() @@ -100,3 +104,361 @@ func TestRoundFloat(t *testing.T) { } } } + +func TestSortinoRatio(t *testing.T) { + t.Parallel() + rfr := 0.001 + figures := []float64{0.10, 0.04, 0.15, -0.05, 0.20, -0.02, 0.08, -0.06, 0.13, 0.23} + avg, err := ArithmeticMean(figures) + if err != nil { + t.Error(err) + } + _, err = SortinoRatio(nil, rfr, avg) + if !errors.Is(err, errZeroValue) { + t.Errorf("expected: %v, received %v", errZeroValue, err) + } + + var r float64 + r, err = SortinoRatio(figures, rfr, avg) + if err != nil { + t.Error(err) + } + if r != 3.0377875479459906 { + t.Errorf("expected 3.0377875479459906, received %v", r) + } + avg, err = FinancialGeometricMean(figures) + if err != nil { + t.Error(err) + } + r, err = SortinoRatio(figures, rfr, avg) + if err != nil { + t.Error(err) + } + if r != 2.8712802265603243 { + t.Errorf("expected 2.525203164136098, received %v", r) + } + + // this follows and matches the example calculation from + // https://www.wallstreetmojo.com/sortino-ratio/ + example := []float64{ + 0.1, + 0.12, + 0.07, + -0.03, + 0.08, + -0.04, + 0.15, + 0.2, + 0.12, + 0.06, + -0.03, + 0.02, + } + avg, err = ArithmeticMean(example) + if err != nil { + t.Error(err) + } + r, err = SortinoRatio(example, 0.06, avg) + if err != nil { + t.Error(err) + } + rr := math.Round(r*10) / 10 + if rr != 0.2 { + t.Errorf("expected 0.2, received %v", rr) + } +} + +func TestInformationRatio(t *testing.T) { + t.Parallel() + figures := []float64{0.0665, 0.0283, 0.0911, 0.0008, -0.0203, -0.0978, 0.0164, -0.0537, 0.078, 0.0032, 0.0249, 0} + comparisonFigures := []float64{0.0216, 0.0048, 0.036, 0.0303, 0.0043, -0.0694, 0.0179, -0.0918, 0.0787, 0.0297, 0.003, 0} + avg, err := ArithmeticMean(figures) + if err != nil { + t.Error(err) + } + if avg != 0.01145 { + t.Error(avg) + } + var avgComparison float64 + avgComparison, err = ArithmeticMean(comparisonFigures) + if err != nil { + t.Error(err) + } + if avgComparison != 0.005425 { + t.Error(avgComparison) + } + + var eachDiff []float64 + for i := range figures { + eachDiff = append(eachDiff, figures[i]-comparisonFigures[i]) + } + stdDev, err := PopulationStandardDeviation(eachDiff) + if err != nil { + t.Error(err) + } + if stdDev != 0.028992588851865803 { + t.Error(stdDev) + } + information := (avg - avgComparison) / stdDev + if information != 0.20781172839666107 { + t.Errorf("expected %v received %v", 0.20781172839666107, information) + } + var information2 float64 + information2, err = InformationRatio(figures, comparisonFigures, avg, avgComparison) + if err != nil { + t.Error(err) + } + if information != information2 { + t.Error(information2) + } + + _, err = InformationRatio(figures, []float64{1}, avg, avgComparison) + if !errors.Is(err, errInformationBadLength) { + t.Errorf("expected: %v, received %v", errInformationBadLength, err) + } +} + +func TestCalmarRatio(t *testing.T) { + t.Parallel() + _, err := CalmarRatio(0, 0, 0, 0) + if !errors.Is(err, errCalmarHighest) { + t.Errorf("expected: %v, received %v", errCalmarHighest, err) + } + var ratio float64 + ratio, err = CalmarRatio(50000, 15000, 0.2, 0.1) + if err != nil { + t.Error(err) + } + if ratio != 0.14285714285714288 { + t.Error(ratio) + } +} + +func TestCAGR(t *testing.T) { + t.Parallel() + _, err := CompoundAnnualGrowthRate( + 0, + 0, + 0, + 0) + if !errors.Is(err, errCAGRNoIntervals) { + t.Error(err) + } + _, err = CompoundAnnualGrowthRate( + 0, + 0, + 0, + 1) + if !errors.Is(err, errCAGRZeroOpenValue) { + t.Error(err) + } + + var cagr float64 + cagr, err = CompoundAnnualGrowthRate( + 100, + 147, + 1, + 1) + if err != nil { + t.Error(err) + } + if cagr != 47 { + t.Error("expected 47%") + } + cagr, err = CompoundAnnualGrowthRate( + 100, + 147, + 365, + 365) + if err != nil { + t.Error(err) + } + if cagr != 47 { + t.Error("expected 47%") + } + + cagr, err = CompoundAnnualGrowthRate( + 100, + 200, + 1, + 20) + if err != nil { + t.Error(err) + } + if cagr != 3.5264923841377582 { + t.Error("expected 3.53%") + } +} + +func TestCalculateSharpeRatio(t *testing.T) { + t.Parallel() + result, err := SharpeRatio(nil, 0, 0) + if !errors.Is(err, errZeroValue) { + t.Error(err) + } + if result != 0 { + t.Error("expected 0") + } + + result, err = SharpeRatio([]float64{0.026}, 0.017, 0.026) + if err != nil { + t.Error(err) + } + if result != 0 { + t.Error("expected 0") + } + + // this follows and matches the example calculation (without rounding) from + // https://www.educba.com/sharpe-ratio-formula/ + returns := []float64{ + -0.0005, + -0.0065, + -0.0113, + 0.0031, + -0.0112, + 0.0056, + 0.0156, + 0.0048, + 0.0012, + 0.0038, + -0.0008, + 0.0032, + 0, + -0.0128, + -0.0058, + 0.003, + 0.0042, + 0.0055, + 0.0009, + } + var avg float64 + avg, err = ArithmeticMean(returns) + if err != nil { + t.Error(err) + } + result, err = SharpeRatio(returns, -0.0017, avg) + if err != nil { + t.Error(err) + } + result = math.Round(result*100) / 100 + if result != 0.26 { + t.Errorf("expected 0.26, received %v", result) + } +} + +func TestStandardDeviation2(t *testing.T) { + t.Parallel() + r := []float64{9, 2, 5, 4, 12, 7} + mean, err := ArithmeticMean(r) + if err != nil { + t.Error(err) + } + superMean := []float64{} + for i := range r { + result := math.Pow(r[i]-mean, 2) + superMean = append(superMean, result) + } + superMeany := (superMean[0] + superMean[1] + superMean[2] + superMean[3] + superMean[4] + superMean[5]) / 5 + manualCalculation := math.Sqrt(superMeany) + var codeCalcu float64 + codeCalcu, err = SampleStandardDeviation(r) + if err != nil { + t.Error(err) + } + if manualCalculation != codeCalcu && codeCalcu != 3.619 { + t.Error("expected 3.619") + } +} + +func TestGeometricAverage(t *testing.T) { + t.Parallel() + values := []float64{1, 2, 3, 4, 5, 6, 7, 8} + _, err := GeometricMean(nil) + if !errors.Is(err, errZeroValue) { + t.Error(err) + } + var mean float64 + mean, err = GeometricMean(values) + if err != nil { + t.Error(err) + } + if mean != 3.764350599503129 { + t.Errorf("expected %v, received %v", 3.95, mean) + } + + values = []float64{15, 12, 13, 19, 10} + mean, err = GeometricMean(values) + if err != nil { + t.Error(err) + } + if mean != 13.477020583645698 { + t.Errorf("expected %v, received %v", 13.50, mean) + } + + values = []float64{-1, 12, 13, 19, 10} + mean, err = GeometricMean(values) + if !errors.Is(err, errGeometricNegative) { + t.Error(err) + } + if mean != 0 { + t.Errorf("expected %v, received %v", 0, mean) + } +} + +func TestFinancialGeometricAverage(t *testing.T) { + t.Parallel() + values := []float64{1, 2, 3, 4, 5, 6, 7, 8} + _, err := FinancialGeometricMean(nil) + if !errors.Is(err, errZeroValue) { + t.Error(err) + } + + var mean float64 + mean, err = FinancialGeometricMean(values) + if err != nil { + t.Error(err) + } + if mean != 3.9541639996482028 { + t.Errorf("expected %v, received %v", 3.95, mean) + } + + values = []float64{15, 12, 13, 19, 10} + mean, err = FinancialGeometricMean(values) + if err != nil { + t.Error(err) + } + if mean != 13.49849123325646 { + t.Errorf("expected %v, received %v", 13.50, mean) + } + + values = []float64{-1, 12, 13, 19, 10} + mean, err = FinancialGeometricMean(values) + if err != nil { + t.Error(err) + } + if mean != 0 { + t.Errorf("expected %v, received %v", 0, mean) + } + + values = []float64{-2, 12, 13, 19, 10} + _, err = FinancialGeometricMean(values) + if !errors.Is(err, errNegativeValueOutOfRange) { + t.Error(err) + } +} + +func TestArithmeticAverage(t *testing.T) { + values := []float64{1, 2, 3, 4, 5, 6, 7, 8} + _, err := ArithmeticMean(nil) + if !errors.Is(err, errZeroValue) { + t.Error(err) + } + var avg float64 + avg, err = ArithmeticMean(values) + if err != nil { + t.Error(err) + } + if avg != 4.5 { + t.Error("expected 4.5") + } +} diff --git a/communications/smtpservice/smtpservice.go b/communications/smtpservice/smtpservice.go index c4c4cfa4..18bda2e8 100644 --- a/communications/smtpservice/smtpservice.go +++ b/communications/smtpservice/smtpservice.go @@ -81,14 +81,10 @@ func (s *SMTPservice) Send(subject, msg string) error { mime, msg) - err := smtp.SendMail( + return smtp.SendMail( s.Host+":"+s.Port, smtp.PlainAuth("", s.AccountName, s.AccountPassword, s.Host), s.From, strings.Split(s.RecipientList, ","), []byte(messageToSend)) - if err != nil { - return err - } - return nil } diff --git a/currency/forexprovider/base/README.md b/currency/forexprovider/base/README.md index 101cbc73..de947fc6 100644 --- a/currency/forexprovider/base/README.md +++ b/currency/forexprovider/base/README.md @@ -1,4 +1,4 @@ -# GoCryptoTrader package Forexprovider +# GoCryptoTrader package Base @@ -10,7 +10,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) -This forexprovider package is part of the GoCryptoTrader codebase. +This base package is part of the GoCryptoTrader codebase. ## This is still in active development @@ -18,7 +18,7 @@ You can track ideas, planned features and what's in progress on this Trello boar Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) -## Current Features for forexprovider +## Current Features for base + This package enforces standard variables and methods for the foreign exchange providers. diff --git a/currency/forexprovider/currencyconverterapi/README.md b/currency/forexprovider/currencyconverterapi/README.md index 3a31c0d9..e07daa54 100644 --- a/currency/forexprovider/currencyconverterapi/README.md +++ b/currency/forexprovider/currencyconverterapi/README.md @@ -1,4 +1,4 @@ -# GoCryptoTrader package Forexprovider +# GoCryptoTrader package Currencyconverterapi @@ -10,7 +10,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) -This forexprovider package is part of the GoCryptoTrader codebase. +This currencyconverterapi package is part of the GoCryptoTrader codebase. ## This is still in active development @@ -18,7 +18,7 @@ You can track ideas, planned features and what's in progress on this Trello boar Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) -## Current Features for forexprovider +## Current Features for currencyconverterapi + Fetches up to date curency data from [Currency Coverter API](https://free.currencyconverterapi.com/) diff --git a/currency/forexprovider/currencylayer/README.md b/currency/forexprovider/currencylayer/README.md index dc4f74d0..d884cb48 100644 --- a/currency/forexprovider/currencylayer/README.md +++ b/currency/forexprovider/currencylayer/README.md @@ -1,4 +1,4 @@ -# GoCryptoTrader package Forexprovider +# GoCryptoTrader package Currencylayer @@ -10,7 +10,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) -This forexprovider package is part of the GoCryptoTrader codebase. +This currencylayer package is part of the GoCryptoTrader codebase. ## This is still in active development @@ -18,7 +18,7 @@ You can track ideas, planned features and what's in progress on this Trello boar Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) -## Current Features for forexprovider +## Current Features for currencylayer + Fetches up to date curency data from [Currency Layer](https://currencylayer.com/) diff --git a/currency/forexprovider/exchangeratesapi.io/README.md b/currency/forexprovider/exchangeratesapi.io/README.md index 10c510d2..a5db7128 100644 --- a/currency/forexprovider/exchangeratesapi.io/README.md +++ b/currency/forexprovider/exchangeratesapi.io/README.md @@ -1,4 +1,4 @@ -# GoCryptoTrader package Forexprovider +# GoCryptoTrader package Exchangeratesapi.Io @@ -10,7 +10,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) -This forexprovider package is part of the GoCryptoTrader codebase. +This exchangeratesapi.io package is part of the GoCryptoTrader codebase. ## This is still in active development @@ -18,7 +18,7 @@ You can track ideas, planned features and what's in progress on this Trello boar Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) -## Current Features for forexprovider +## Current Features for exchangeratesapi.io + Fetches up to date curency data from [Exchange rates API]("http://exchangeratesapi.io") diff --git a/currency/forexprovider/fixer.io/README.md b/currency/forexprovider/fixer.io/README.md index 9403cef5..f3b9dafc 100644 --- a/currency/forexprovider/fixer.io/README.md +++ b/currency/forexprovider/fixer.io/README.md @@ -1,4 +1,4 @@ -# GoCryptoTrader package Forexprovider +# GoCryptoTrader package Fixer.Io @@ -10,7 +10,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) -This forexprovider package is part of the GoCryptoTrader codebase. +This fixer.io package is part of the GoCryptoTrader codebase. ## This is still in active development @@ -18,7 +18,7 @@ You can track ideas, planned features and what's in progress on this Trello boar Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) -## Current Features for forexprovider +## Current Features for fixer.io + Fetches up to date curency data from [Fixer.io](https://fixer.io/) diff --git a/currency/forexprovider/openexchangerates/README.md b/currency/forexprovider/openexchangerates/README.md index c3234116..ef3edbd4 100644 --- a/currency/forexprovider/openexchangerates/README.md +++ b/currency/forexprovider/openexchangerates/README.md @@ -1,4 +1,4 @@ -# GoCryptoTrader package Forexprovider +# GoCryptoTrader package Openexchangerates @@ -10,7 +10,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) -This forexprovider package is part of the GoCryptoTrader codebase. +This openexchangerates package is part of the GoCryptoTrader codebase. ## This is still in active development @@ -18,7 +18,7 @@ You can track ideas, planned features and what's in progress on this Trello boar Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk) -## Current Features for forexprovider +## Current Features for openexchangerates + Fetches up to date curency data from [Open Exchange Rates](https://openexchangerates.org/) diff --git a/database/repository/exchange/exchange_types.go b/database/repository/exchange/exchange_types.go index b143e8df..abfe9243 100644 --- a/database/repository/exchange/exchange_types.go +++ b/database/repository/exchange/exchange_types.go @@ -8,7 +8,8 @@ import ( ) var ( - exchangeCache = cache.New(10) + exchangeCache = cache.New(10) + // ErrNoExchangeFound is a basic predefined error ErrNoExchangeFound = errors.New("exchange not found") ) diff --git a/engine/engine.go b/engine/engine.go index 7cb90c4c..a63d8360 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -51,6 +51,8 @@ var ( // New starts a new engine func New() (*Engine, error) { + newEngineMutex.Lock() + defer newEngineMutex.Unlock() var b Engine b.Config = &config.Cfg @@ -68,6 +70,8 @@ func New() (*Engine, error) { // NewFromSettings starts a new engine based on supplied settings func NewFromSettings(settings *Settings, flagSet map[string]bool) (*Engine, error) { + newEngineMutex.Lock() + defer newEngineMutex.Unlock() if settings == nil { return nil, errors.New("engine: settings is nil") } @@ -113,7 +117,7 @@ func loadConfigWithSettings(settings *Settings, flagSet map[string]bool) (*confi } log.Printf("Loading config file %s..\n", filePath) - conf := &config.Cfg + conf := &config.Config{} err = conf.ReadConfigFromFile(filePath, settings.EnableDryRun) if err != nil { return nil, fmt.Errorf(config.ErrFailureOpeningConfig, filePath, err) @@ -338,6 +342,9 @@ func (bot *Engine) Start() error { return errors.New("engine instance is nil") } + newEngineMutex.Lock() + defer newEngineMutex.Unlock() + if bot.Settings.EnableDatabaseManager { if err := bot.DatabaseManager.Start(bot); err != nil { gctlog.Errorf(gctlog.Global, "Database manager unable to start: %v", err) @@ -399,25 +406,31 @@ func (bot *Engine) Start() error { gctlog.Errorf(gctlog.Global, "Communications manager unable to start: %v\n", err) } } - - err := currency.RunStorageUpdater(currency.BotOverrides{ - Coinmarketcap: bot.Settings.EnableCoinmarketcapAnalysis, - FxCurrencyConverter: bot.Settings.EnableCurrencyConverter, - FxCurrencyLayer: bot.Settings.EnableCurrencyLayer, - FxFixer: bot.Settings.EnableFixer, - FxOpenExchangeRates: bot.Settings.EnableOpenExchangeRates, - }, - ¤cy.MainConfiguration{ - ForexProviders: bot.Config.GetForexProviders(), - CryptocurrencyProvider: coinmarketcap.Settings(bot.Config.Currency.CryptocurrencyProvider), - Cryptocurrencies: bot.Config.Currency.Cryptocurrencies, - FiatDisplayCurrency: bot.Config.Currency.FiatDisplayCurrency, - CurrencyDelay: bot.Config.Currency.CurrencyFileUpdateDuration, - FxRateDelay: bot.Config.Currency.ForeignExchangeUpdateDuration, + var err error + if bot.Settings.EnableCoinmarketcapAnalysis || + bot.Settings.EnableCurrencyConverter || + bot.Settings.EnableCurrencyLayer || + bot.Settings.EnableFixer || + bot.Settings.EnableOpenExchangeRates { + err = currency.RunStorageUpdater(currency.BotOverrides{ + Coinmarketcap: bot.Settings.EnableCoinmarketcapAnalysis, + FxCurrencyConverter: bot.Settings.EnableCurrencyConverter, + FxCurrencyLayer: bot.Settings.EnableCurrencyLayer, + FxFixer: bot.Settings.EnableFixer, + FxOpenExchangeRates: bot.Settings.EnableOpenExchangeRates, }, - bot.Settings.DataDir) - if err != nil { - gctlog.Errorf(gctlog.Global, "Currency updater system failed to start %v", err) + ¤cy.MainConfiguration{ + ForexProviders: bot.Config.GetForexProviders(), + CryptocurrencyProvider: coinmarketcap.Settings(bot.Config.Currency.CryptocurrencyProvider), + Cryptocurrencies: bot.Config.Currency.Cryptocurrencies, + FiatDisplayCurrency: bot.Config.Currency.FiatDisplayCurrency, + CurrencyDelay: bot.Config.Currency.CurrencyFileUpdateDuration, + FxRateDelay: bot.Config.Currency.ForeignExchangeUpdateDuration, + }, + bot.Settings.DataDir) + if err != nil { + gctlog.Errorf(gctlog.Global, "ExchangeSettings updater system failed to start %v", err) + } } if bot.Settings.EnableGRPC { @@ -445,7 +458,7 @@ func (bot *Engine) Start() error { } if bot.Settings.EnableOrderManager { - if err = bot.OrderManager.Start(); err != nil { + if err = bot.OrderManager.Start(bot); err != nil { gctlog.Errorf(gctlog.Global, "Order manager unable to start: %v", err) } } @@ -470,7 +483,7 @@ func (bot *Engine) Start() error { } if bot.Settings.EnableEventManager { - go EventManger() + go EventManger(bot.Settings.Verbose, &bot.CommsManager) } if bot.Settings.EnableWebsocketRoutine { @@ -488,6 +501,9 @@ func (bot *Engine) Start() error { // Stop correctly shuts down engine saving configuration files func (bot *Engine) Stop() { + newEngineMutex.Lock() + defer newEngineMutex.Unlock() + gctlog.Debugln(gctlog.Global, "Engine shutting down..") if len(portfolio.Portfolio.Addresses) != 0 { @@ -540,9 +556,14 @@ func (bot *Engine) Stop() { gctlog.Errorf(gctlog.DispatchMgr, "Dispatch system unable to stop. Error: %v", err) } } - - if err := currency.ShutdownStorageUpdater(); err != nil { - gctlog.Errorf(gctlog.Global, "Currency storage system. Error: %v", err) + if bot.Settings.EnableCoinmarketcapAnalysis || + bot.Settings.EnableCurrencyConverter || + bot.Settings.EnableCurrencyLayer || + bot.Settings.EnableFixer || + bot.Settings.EnableOpenExchangeRates { + if err := currency.ShutdownStorageUpdater(); err != nil { + gctlog.Errorf(gctlog.Global, "ExchangeSettings storage system. Error: %v", err) + } } if !bot.Settings.EnableDryRun { diff --git a/engine/engine_types.go b/engine/engine_types.go index a58c5212..1aaae2b7 100644 --- a/engine/engine_types.go +++ b/engine/engine_types.go @@ -1,6 +1,9 @@ package engine -import "time" +import ( + "sync" + "time" +) // Settings stores engine params type Settings struct { @@ -92,3 +95,8 @@ const ( // MsgStatusError message to display when failure occurs MsgStatusError string = "error" ) + +// newConfigMutex only locks and unlocks on engine creation functions +// as engine modifies global files, this protects the main bot creation +// functions from interfering with eachother +var newEngineMutex sync.Mutex diff --git a/engine/events.go b/engine/events.go index f614f9fb..92bab065 100644 --- a/engine/events.go +++ b/engine/events.go @@ -146,17 +146,17 @@ func (e *Event) String() string { ) } -func (e *Event) processTicker() bool { +func (e *Event) processTicker(verbose bool) bool { t, err := ticker.GetTicker(e.Exchange, e.Pair, e.Asset) if err != nil { - if Bot.Settings.Verbose { + if verbose { log.Debugf(log.EventMgr, "Events: failed to get ticker. Err: %s\n", err) } return false } if t.Last == 0 { - if Bot.Settings.Verbose { + if verbose { log.Debugln(log.EventMgr, "Events: ticker last price is 0") } return false @@ -190,10 +190,10 @@ func (e *Event) processCondition(actual, threshold float64) bool { return false } -func (e *Event) processOrderbook() bool { +func (e *Event) processOrderbook(verbose bool) bool { ob, err := orderbook.Get(e.Exchange, e.Pair, e.Asset) if err != nil { - if Bot.Settings.Verbose { + if verbose { log.Debugf(log.EventMgr, "Events: Failed to get orderbook. Err: %s\n", err) } return false @@ -226,11 +226,11 @@ func (e *Event) processOrderbook() bool { // CheckEventCondition will check the event structure to see if there is a condition // met -func (e *Event) CheckEventCondition() bool { +func (e *Event) CheckEventCondition(verbose bool) bool { if e.Item == ItemPrice { - return e.processTicker() + return e.processTicker(verbose) } - return e.processOrderbook() + return e.processOrderbook(verbose) } // IsValidEvent checks the actions to be taken and returns an error if incorrect @@ -278,7 +278,7 @@ func IsValidEvent(exchange, item string, condition EventConditionParams, action // EventManger is the overarching routine that will iterate through the Events // chain -func EventManger() { +func EventManger(verbose bool, comManager *commsManager) { log.Debugf(log.EventMgr, "EventManager started. SleepDelay: %v\n", EventSleepDelay.String()) for { @@ -286,17 +286,17 @@ func EventManger() { if total > 0 && executed != total { for _, event := range Events { if !event.Executed { - if Bot.Settings.Verbose { + if verbose { log.Debugf(log.EventMgr, "Events: Processing event %s.\n", event.String()) } - success := event.CheckEventCondition() + success := event.CheckEventCondition(verbose) if success { msg := fmt.Sprintf( "Events: ID: %d triggered on %s successfully [%v]\n", event.ID, event.Exchange, event.String(), ) log.Infoln(log.EventMgr, msg) - Bot.CommsManager.PushEvent(base.Event{Type: "event", Message: msg}) + comManager.PushEvent(base.Event{Type: "event", Message: msg}) event.Executed = true } } diff --git a/engine/events_test.go b/engine/events_test.go index 9784c1d0..0e88df76 100644 --- a/engine/events_test.go +++ b/engine/events_test.go @@ -3,6 +3,7 @@ package engine import ( "testing" + "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" @@ -23,7 +24,10 @@ func addValidEvent() (int64, error) { } func TestAdd(t *testing.T) { - SetupTestHelpers(t) + bot := CreateTestBot(t) + if config.Cfg.Name == "" && bot != nil { + config.Cfg = *bot.Config + } _, err := Add("", "", EventConditionParams{}, currency.Pair{}, "", "") if err == nil { t.Error("should err on invalid params") @@ -45,7 +49,10 @@ func TestAdd(t *testing.T) { } func TestRemove(t *testing.T) { - SetupTestHelpers(t) + bot := CreateTestBot(t) + if config.Cfg.Name == "" && bot != nil { + config.Cfg = *bot.Config + } id, err := addValidEvent() if err != nil { t.Error("unexpected result", err) @@ -61,7 +68,10 @@ func TestRemove(t *testing.T) { } func TestGetEventCounter(t *testing.T) { - SetupTestHelpers(t) + bot := CreateTestBot(t) + if config.Cfg.Name == "" && bot != nil { + config.Cfg = *bot.Config + } _, err := addValidEvent() if err != nil { t.Error("unexpected result", err) @@ -81,8 +91,12 @@ func TestGetEventCounter(t *testing.T) { func TestExecuteAction(t *testing.T) { t.Parallel() + bot := CreateTestBot(t) if Bot == nil { - Bot = new(Engine) + Bot = bot + } + if config.Cfg.Name == "" && bot != nil { + config.Cfg = *bot.Config } var e Event @@ -121,10 +135,6 @@ func TestString(t *testing.T) { } func TestProcessTicker(t *testing.T) { - if Bot == nil { - Bot = new(Engine) - } - e := Event{ Exchange: testExchange, Pair: currency.NewPair(currency.BTC, currency.USD), @@ -144,7 +154,7 @@ func TestProcessTicker(t *testing.T) { if err := ticker.ProcessTicker(&tick); err != nil { t.Fatal("unexpected result:", err) } - if r := e.processTicker(); r { + if r := e.processTicker(false); r { t.Error("unexpected result") } @@ -153,7 +163,7 @@ func TestProcessTicker(t *testing.T) { if err := ticker.ProcessTicker(&tick); err != nil { t.Fatal("unexpected result:", err) } - if r := e.processTicker(); !r { + if r := e.processTicker(false); !r { t.Error("unexpected result") } } @@ -187,10 +197,6 @@ func TestProcessCondition(t *testing.T) { } func TestProcessOrderbook(t *testing.T) { - if Bot == nil { - Bot = new(Engine) - } - e := Event{ Exchange: testExchange, Pair: currency.NewPair(currency.BTC, currency.USD), @@ -214,7 +220,7 @@ func TestProcessOrderbook(t *testing.T) { t.Fatal("unexpected result:", err) } - if r := e.processOrderbook(); !r { + if r := e.processOrderbook(false); !r { t.Error("unexpected result") } } @@ -228,18 +234,21 @@ func TestCheckEventCondition(t *testing.T) { e := Event{ Item: ItemPrice, } - if r := e.CheckEventCondition(); r { + if r := e.CheckEventCondition(false); r { t.Error("unexpected result") } e.Item = ItemOrderbook - if r := e.CheckEventCondition(); r { + if r := e.CheckEventCondition(false); r { t.Error("unexpected result") } } func TestIsValidEvent(t *testing.T) { - SetupTestHelpers(t) + bot := CreateTestBot(t) + if config.Cfg.Name == "" && bot != nil { + config.Cfg = *bot.Config + } // invalid exchange name if err := IsValidEvent("meow", "", EventConditionParams{}, ""); err != errExchangeDisabled { t.Error("unexpected result:", err) @@ -290,7 +299,7 @@ func TestIsValidExchange(t *testing.T) { if s := IsValidExchange("invalidexchangerino"); s { t.Error("unexpected result") } - SetupTestHelpers(t) + CreateTestBot(t) if s := IsValidExchange(testExchange); !s { t.Error("unexpected result") } diff --git a/engine/exchange.go b/engine/exchange.go index efaec98f..0451bae3 100644 --- a/engine/exchange.go +++ b/engine/exchange.go @@ -124,21 +124,6 @@ func (e *exchangeManager) Len() int { return len(e.exchanges) } -func (e *exchangeManager) unloadExchange(exchangeName string) error { - exchCfg, err := Bot.Config.GetExchangeConfig(exchangeName) - if err != nil { - return err - } - - err = e.removeExchange(exchangeName) - if err != nil { - return err - } - - exchCfg.Enabled = false - return nil -} - // GetExchangeByName returns an exchange given an exchange name func (bot *Engine) GetExchangeByName(exchName string) exchange.IBotExchange { return bot.exchangeManager.getExchangeByName(exchName) @@ -146,7 +131,18 @@ func (bot *Engine) GetExchangeByName(exchName string) exchange.IBotExchange { // UnloadExchange unloads an exchange by name func (bot *Engine) UnloadExchange(exchName string) error { - return bot.exchangeManager.unloadExchange(exchName) + exchCfg, err := bot.Config.GetExchangeConfig(exchName) + if err != nil { + return err + } + + err = bot.exchangeManager.removeExchange(exchName) + if err != nil { + return err + } + + exchCfg.Enabled = false + return nil } // GetExchanges retrieves the loaded exchanges diff --git a/engine/exchange_test.go b/engine/exchange_test.go index b4cc1bb2..53a8cfe7 100644 --- a/engine/exchange_test.go +++ b/engine/exchange_test.go @@ -6,23 +6,6 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/bitfinex" ) -func CleanupTest(t *testing.T) { - if Bot.GetExchangeByName(testExchange) != nil { - err := Bot.UnloadExchange(testExchange) - if err != nil { - t.Fatalf("CleanupTest: Failed to unload exchange: %s", - err) - } - } - if Bot.GetExchangeByName(fakePassExchange) != nil { - err := Bot.UnloadExchange(fakePassExchange) - if err != nil { - t.Fatalf("CleanupTest: Failed to unload exchange: %s", - err) - } - } -} - func TestExchangeManagerAdd(t *testing.T) { t.Parallel() var e exchangeManager @@ -69,7 +52,7 @@ func TestExchangeManagerRemoveExchange(t *testing.T) { } func TestCheckExchangeExists(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) if e.GetExchangeByName(testExchange) == nil { t.Errorf("TestGetExchangeExists: Unable to find exchange") @@ -78,12 +61,10 @@ func TestCheckExchangeExists(t *testing.T) { if e.GetExchangeByName("Asdsad") != nil { t.Errorf("TestGetExchangeExists: Non-existent exchange found") } - - CleanupTest(t) } func TestGetExchangeByName(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) exch := e.GetExchangeByName(testExchange) if exch == nil { @@ -108,12 +89,10 @@ func TestGetExchangeByName(t *testing.T) { if exch != nil { t.Errorf("TestGetExchangeByName: Non-existent exchange found") } - - CleanupTest(t) } func TestUnloadExchange(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) err := e.UnloadExchange("asdf") if err == nil || err.Error() != "exchange asdf not found" { @@ -138,45 +117,31 @@ func TestUnloadExchange(t *testing.T) { t.Errorf("TestUnloadExchange: Incorrect result: %s", err) } - - CleanupTest(t) } func TestDryRunParamInteraction(t *testing.T) { - bot := SetupTestHelpers(t) + bot := CreateTestBot(t) + + // Simulate overiding default settings and ensure that enabling exchange + // verbose mode will be set on Bitfinex + var err error + if err = bot.UnloadExchange(testExchange); err != nil { + t.Error(err) + } + + bot.Settings.CheckParamInteraction = false + bot.Settings.EnableExchangeVerbose = false + if err = bot.LoadExchange(testExchange, false, nil); err != nil { + t.Error(err) + } - // Load bot as per normal, dry run and verbose for Bitfinex should be - // disabled exchCfg, err := bot.Config.GetExchangeConfig(testExchange) if err != nil { t.Error(err) } - if bot.Settings.EnableDryRun || - exchCfg.Verbose { - t.Error("dryrun and verbose should have been disabled") - } - - // Simulate overiding default settings and ensure that enabling exchange - // verbose mode will be set on Bitfinex - if err = bot.UnloadExchange(testExchange); err != nil { - t.Error(err) - } - - bot.Settings.CheckParamInteraction = true - bot.Settings.EnableExchangeVerbose = true - if err = bot.LoadExchange(testExchange, false, nil); err != nil { - t.Error(err) - } - - exchCfg, err = bot.Config.GetExchangeConfig(testExchange) - if err != nil { - t.Error(err) - } - - if !bot.Settings.EnableDryRun || - !exchCfg.Verbose { - t.Error("dryrun and verbose should have been enabled") + if exchCfg.Verbose { + t.Error("verbose should have been disabled") } if err = bot.UnloadExchange(testExchange); err != nil { diff --git a/engine/fake_exchange_test.go b/engine/fake_exchange_test.go index e42933d1..87ff27f3 100644 --- a/engine/fake_exchange_test.go +++ b/engine/fake_exchange_test.go @@ -30,19 +30,19 @@ type FakePassingExchange struct { } // addPassingFakeExchange adds an exchange to engine tests where all funcs return a positive result -func addPassingFakeExchange(baseExchangeName string) error { - testExch := Bot.GetExchangeByName(baseExchangeName) +func addPassingFakeExchange(baseExchangeName string, bot *Engine) error { + testExch := bot.GetExchangeByName(baseExchangeName) if testExch == nil { return ErrExchangeNotFound } base := testExch.GetBase() - Bot.Config.Exchanges = append(Bot.Config.Exchanges, config.ExchangeConfig{ + bot.Config.Exchanges = append(bot.Config.Exchanges, config.ExchangeConfig{ Name: fakePassExchange, Enabled: true, Verbose: false, }) - Bot.exchangeManager.add(&FakePassingExchange{ + bot.exchangeManager.add(&FakePassingExchange{ Base: exchange.Base{ Name: fakePassExchange, Enabled: true, diff --git a/engine/helpers.go b/engine/helpers.go index e5155ba6..f16f8e89 100644 --- a/engine/helpers.go +++ b/engine/helpers.go @@ -100,7 +100,7 @@ func (bot *Engine) SetSubsystem(subsys string, enable bool) error { return bot.CommsManager.Stop() case "orders": if enable { - return bot.OrderManager.Start() + return bot.OrderManager.Start(bot) } return bot.OrderManager.Stop() case "portfolio": @@ -682,9 +682,9 @@ func (bot *Engine) GetExchangeCryptocurrencyDepositAddresses() map[string]map[st // FormatCurrency is a method that formats and returns a currency pair // based on the user currency display preferences -func FormatCurrency(p currency.Pair) currency.Pair { - return p.Format(Bot.Config.Currency.CurrencyPairFormat.Delimiter, - Bot.Config.Currency.CurrencyPairFormat.Uppercase) +func (bot *Engine) FormatCurrency(p currency.Pair) currency.Pair { + return p.Format(bot.Config.Currency.CurrencyPairFormat.Delimiter, + bot.Config.Currency.CurrencyPairFormat.Uppercase) } // GetExchangeNames returns a list of enabled or disabled exchanges diff --git a/engine/helpers_test.go b/engine/helpers_test.go index 9ad166f9..d3591b87 100644 --- a/engine/helpers_test.go +++ b/engine/helpers_test.go @@ -25,44 +25,34 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" ) -var ( - helperTestLoaded = false -) - -func SetupTestHelpers(t *testing.T) *Engine { - if !helperTestLoaded { - if Bot == nil { - Bot = new(Engine) - } - Bot.Config = &config.Cfg - err := Bot.Config.LoadConfig(config.TestFile, true) - if err != nil { - t.Fatalf("SetupTest: Failed to load config: %s", err) - } - err = Bot.Config.RetrieveConfigCurrencyPairs(true, asset.Spot) - if err != nil { - t.Fatalf("Failed to retrieve config currency pairs. %s", err) - } - helperTestLoaded = true +func CreateTestBot(t *testing.T) *Engine { + bot, err := NewFromSettings(&Settings{ConfigFile: config.TestFile, EnableDryRun: true}, nil) + if err != nil { + t.Fatal(err) } - if Bot.GetExchangeByName(testExchange) == nil { - err := Bot.LoadExchange(testExchange, false, nil) + err = bot.Config.RetrieveConfigCurrencyPairs(true, asset.Spot) + if err != nil { + t.Fatalf("Failed to retrieve config currency pairs. %s", err) + } + + if bot.GetExchangeByName(testExchange) == nil { + err := bot.LoadExchange(testExchange, false, nil) if err != nil { t.Fatalf("SetupTest: Failed to load exchange: %s", err) } } - if Bot.GetExchangeByName(fakePassExchange) == nil { - err := addPassingFakeExchange(testExchange) + if bot.GetExchangeByName(fakePassExchange) == nil { + err := addPassingFakeExchange(testExchange, bot) if err != nil { t.Fatalf("SetupTest: Failed to load exchange: %s", err) } } - return Bot + return bot } func TestGetExchangeOTPs(t *testing.T) { - bot := SetupTestHelpers(t) + bot := CreateTestBot(t) _, err := bot.GetExchangeOTPs() if err == nil { t.Fatal("Expected err with no exchange OTP secrets set") @@ -102,7 +92,7 @@ func TestGetExchangeOTPs(t *testing.T) { } func TestGetExchangeoOTPByName(t *testing.T) { - bot := SetupTestHelpers(t) + bot := CreateTestBot(t) _, err := bot.GetExchangeoOTPByName("Bitstamp") if err == nil { t.Fatal("Expected err with no exchange OTP secrets set") @@ -127,14 +117,14 @@ func TestGetExchangeoOTPByName(t *testing.T) { } func TestGetAuthAPISupportedExchanges(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) if result := e.GetAuthAPISupportedExchanges(); len(result) != 1 { t.Fatal("Unexpected result", result) } } func TestIsOnline(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) if r := e.IsOnline(); r { t.Fatal("Unexpected result") } @@ -161,14 +151,14 @@ func TestIsOnline(t *testing.T) { } func TestGetAvailableExchanges(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) if r := len(e.GetAvailableExchanges()); r == 0 { t.Error("Expected len > 0") } } func TestGetSpecificAvailablePairs(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) assetType := asset.Spot result := e.GetSpecificAvailablePairs(true, true, true, false, assetType) @@ -208,7 +198,7 @@ func TestGetSpecificAvailablePairs(t *testing.T) { } func TestIsRelatablePairs(t *testing.T) { - SetupTestHelpers(t) + CreateTestBot(t) xbtusd, err := currency.NewPairFromStrings("XBT", "USD") if err != nil { t.Fatal(err) @@ -397,7 +387,7 @@ func TestIsRelatablePairs(t *testing.T) { } func TestGetRelatableCryptocurrencies(t *testing.T) { - SetupTestHelpers(t) + CreateTestBot(t) btcltc, err := currency.NewPairFromStrings("BTC", "LTC") if err != nil { t.Fatal(err) @@ -448,7 +438,7 @@ func TestGetRelatableCryptocurrencies(t *testing.T) { } func TestGetRelatableFiatCurrencies(t *testing.T) { - SetupTestHelpers(t) + CreateTestBot(t) btsusd, err := currency.NewPairFromStrings("BTC", "USD") if err != nil { @@ -477,7 +467,7 @@ func TestGetRelatableFiatCurrencies(t *testing.T) { } func TestMapCurrenciesByExchange(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) var pairs = []currency.Pair{ currency.NewPair(currency.BTC, currency.USD), @@ -496,7 +486,7 @@ func TestMapCurrenciesByExchange(t *testing.T) { } func TestGetExchangeNamesByCurrency(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) assetType := asset.Spot btsusd, err := currency.NewPairFromStrings("BTC", "USD") @@ -537,7 +527,7 @@ func TestGetExchangeNamesByCurrency(t *testing.T) { } func TestGetSpecificOrderbook(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) e.LoadExchange("Bitstamp", false, nil) @@ -584,7 +574,7 @@ func TestGetSpecificOrderbook(t *testing.T) { } func TestGetSpecificTicker(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) e.LoadExchange("Bitstamp", false, nil) p, err := currency.NewPairFromStrings("BTC", "USD") @@ -624,7 +614,7 @@ func TestGetSpecificTicker(t *testing.T) { } func TestGetCollatedExchangeAccountInfoByCoin(t *testing.T) { - SetupTestHelpers(t) + CreateTestBot(t) var exchangeInfo []account.Holdings @@ -684,7 +674,7 @@ func TestGetCollatedExchangeAccountInfoByCoin(t *testing.T) { } func TestGetExchangeHighestPriceByCurrencyPair(t *testing.T) { - SetupTestHelpers(t) + CreateTestBot(t) p, err := currency.NewPairFromStrings("BTC", "USD") if err != nil { @@ -714,7 +704,7 @@ func TestGetExchangeHighestPriceByCurrencyPair(t *testing.T) { } func TestGetExchangeLowestPriceByCurrencyPair(t *testing.T) { - SetupTestHelpers(t) + CreateTestBot(t) p, err := currency.NewPairFromStrings("BTC", "USD") if err != nil { @@ -744,7 +734,7 @@ func TestGetExchangeLowestPriceByCurrencyPair(t *testing.T) { } func TestGetCryptocurrenciesByExchange(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) _, err := e.GetCryptocurrenciesByExchange("Bitfinex", false, false, asset.Spot) if err != nil { @@ -753,7 +743,7 @@ func TestGetCryptocurrenciesByExchange(t *testing.T) { } func TestGetExchangeNames(t *testing.T) { - bot := SetupTestHelpers(t) + bot := CreateTestBot(t) if e := bot.GetExchangeNames(true); len(e) == 0 { t.Error("exchange names should be populated") } diff --git a/engine/orders.go b/engine/orders.go index 646542ec..9633d96d 100644 --- a/engine/orders.go +++ b/engine/orders.go @@ -18,7 +18,7 @@ import ( // vars for the fund manager package var ( - OrderManagerDelay = time.Second * 10 + orderManagerDelay = time.Second * 10 ErrOrdersAlreadyExists = errors.New("order already exists") ErrOrderNotFound = errors.New("order does not exist") ) @@ -99,7 +99,7 @@ func (o *orderStore) Add(det *order.Detail) error { if det == nil { return errors.New("order store: Order is nil") } - exch := Bot.GetExchangeByName(det.Exchange) + exch := o.bot.GetExchangeByName(det.Exchange) if exch == nil { return ErrExchangeNotFound } @@ -132,15 +132,19 @@ func (o *orderManager) Started() bool { } // Start will boot up the orderManager -func (o *orderManager) Start() error { - if atomic.AddInt32(&o.started, 1) != 1 { - return errors.New("order manager already started") +func (o *orderManager) Start(bot *Engine) error { + if bot == nil { + return errors.New("cannot start with nil bot") + } + if !atomic.CompareAndSwapInt32(&o.started, 0, 1) { + return errors.New("could not start order manager") } - log.Debugln(log.OrderBook, "Order manager starting...") o.shutdown = make(chan struct{}) o.orderStore.Orders = make(map[string][]*order.Detail) + o.orderStore.bot = bot + go o.run() return nil } @@ -151,7 +155,7 @@ func (o *orderManager) Stop() error { return errors.New("order manager not started") } - if atomic.AddInt32(&o.stopped, 1) != 1 { + if !atomic.CompareAndSwapInt32(&o.stopped, 0, 1) { return errors.New("order manager is already stopped") } defer func() { @@ -167,18 +171,18 @@ func (o *orderManager) Stop() error { func (o *orderManager) gracefulShutdown() { if o.cfg.CancelOrdersOnShutdown { log.Debugln(log.OrderMgr, "Order manager: Cancelling any open orders...") - o.CancelAllOrders(Bot.Config.GetEnabledExchanges()) + o.CancelAllOrders(o.orderStore.bot.Config.GetEnabledExchanges()) } } func (o *orderManager) run() { log.Debugln(log.OrderBook, "Order manager started.") - tick := time.NewTicker(OrderManagerDelay) - Bot.ServicesWG.Add(1) + tick := time.NewTicker(orderManagerDelay) + o.orderStore.bot.ServicesWG.Add(1) defer func() { log.Debugln(log.OrderMgr, "Order manager shutdown.") tick.Stop() - Bot.ServicesWG.Done() + o.orderStore.bot.ServicesWG.Done() }() for { @@ -231,7 +235,7 @@ func (o *orderManager) Cancel(cancel *order.Cancel) error { var err error defer func() { if err != nil { - Bot.CommsManager.PushEvent(base.Event{ + o.orderStore.bot.CommsManager.PushEvent(base.Event{ Type: "order", Message: err.Error(), }) @@ -251,7 +255,7 @@ func (o *orderManager) Cancel(cancel *order.Cancel) error { return err } - exch := Bot.GetExchangeByName(cancel.Exchange) + exch := o.orderStore.bot.GetExchangeByName(cancel.Exchange) if exch == nil { err = ErrExchangeNotFound return err @@ -281,7 +285,7 @@ func (o *orderManager) Cancel(cancel *order.Cancel) error { msg := fmt.Sprintf("Order manager: Exchange %s order ID=%v cancelled.", od.Exchange, od.ID) log.Debugln(log.OrderMgr, msg) - Bot.CommsManager.PushEvent(base.Event{ + o.orderStore.bot.CommsManager.PushEvent(base.Event{ Type: "order", Message: msg, }) @@ -296,7 +300,7 @@ func (o *orderManager) GetOrderInfo(exchangeName, orderID string, cp currency.Pa return order.Detail{}, errOrderCannotBeEmpty } - exch := Bot.GetExchangeByName(exchangeName) + exch := o.orderStore.bot.GetExchangeByName(exchangeName) if exch == nil { return order.Detail{}, ErrExchangeNotFound } @@ -313,61 +317,112 @@ func (o *orderManager) GetOrderInfo(exchangeName, orderID string, cp currency.Pa return result, nil } -// Submit will take in an order struct, send it to the exchange and -// populate it in the orderManager if successful -func (o *orderManager) Submit(newOrder *order.Submit) (*orderSubmitResponse, error) { +func (o *orderManager) validate(newOrder *order.Submit) error { if newOrder == nil { - return nil, errors.New("order cannot be nil") + return errors.New("order cannot be nil") } if newOrder.Exchange == "" { - return nil, errors.New("order exchange name must be specified") + return errors.New("order exchange name must be specified") } if err := newOrder.Validate(); err != nil { - return nil, err + return err } if o.cfg.EnforceLimitConfig { if !o.cfg.AllowMarketOrders && newOrder.Type == order.Market { - return nil, errors.New("order market type is not allowed") + return errors.New("order market type is not allowed") } if o.cfg.LimitAmount > 0 && newOrder.Amount > o.cfg.LimitAmount { - return nil, errors.New("order limit exceeds allowed limit") + return errors.New("order limit exceeds allowed limit") } if len(o.cfg.AllowedExchanges) > 0 && !common.StringDataCompareInsensitive(o.cfg.AllowedExchanges, newOrder.Exchange) { - return nil, errors.New("order exchange not found in allowed list") + return errors.New("order exchange not found in allowed list") } if len(o.cfg.AllowedPairs) > 0 && !o.cfg.AllowedPairs.Contains(newOrder.Pair, true) { - return nil, errors.New("order pair not found in allowed list") + return errors.New("order pair not found in allowed list") } } + return nil +} - exch := Bot.GetExchangeByName(newOrder.Exchange) +// Submit will take in an order struct, send it to the exchange and +// populate it in the orderManager if successful +func (o *orderManager) Submit(newOrder *order.Submit) (*orderSubmitResponse, error) { + err := o.validate(newOrder) + if err != nil { + return nil, err + } + exch := o.orderStore.bot.GetExchangeByName(newOrder.Exchange) if exch == nil { return nil, ErrExchangeNotFound } - result, err := exch.SubmitOrder(newOrder) + var result order.SubmitResponse + result, err = exch.SubmitOrder(newOrder) if err != nil { return nil, err } + return o.processSubmittedOrder(newOrder, result) +} + +// SubmitFakeOrder runs through the same process as order submission +// but does not touch live endpoints +func (o *orderManager) SubmitFakeOrder(newOrder *order.Submit, resultingOrder order.SubmitResponse) (*orderSubmitResponse, error) { + err := o.validate(newOrder) + if err != nil { + return nil, err + } + exch := o.orderStore.bot.GetExchangeByName(newOrder.Exchange) + if exch == nil { + return nil, ErrExchangeNotFound + } + + return o.processSubmittedOrder(newOrder, resultingOrder) +} + +// GetOrdersSnapshot returns a snapshot of all orders in the orderstore. It optionally filters any orders that do not match the status +// but a status of "" or ANY will include all +// the time adds contexts for the when the snapshot is relevant for +func (o *orderManager) GetOrdersSnapshot(s order.Status) ([]order.Detail, time.Time) { + var os []order.Detail + var latestUpdate time.Time + for _, v := range o.orderStore.Orders { + for i := range v { + if s != v[i].Status && + s != order.AnyStatus && + s != "" { + continue + } + if v[i].LastUpdated.After(latestUpdate) { + latestUpdate = v[i].LastUpdated + } + + cpy := *v[i] + os = append(os, cpy) + } + } + + return os, latestUpdate +} + +func (o *orderManager) processSubmittedOrder(newOrder *order.Submit, result order.SubmitResponse) (*orderSubmitResponse, error) { if !result.IsOrderPlaced { return nil, errors.New("order unable to be placed") } - var id uuid.UUID - id, err = uuid.NewV4() + id, err := uuid.NewV4() if err != nil { log.Warnf(log.OrderMgr, "Order manager: Unable to generate UUID. Err: %s", err) } - msg := fmt.Sprintf("Order manager: Exchange %s submitted order ID=%v [Ours: %v] pair=%v price=%v amount=%v side=%v type=%v.", + msg := fmt.Sprintf("Order manager: Exchange %s submitted order ID=%v [Ours: %v] pair=%v price=%v amount=%v side=%v type=%v for time %v.", newOrder.Exchange, result.OrderID, id.String(), @@ -375,10 +430,11 @@ func (o *orderManager) Submit(newOrder *order.Submit) (*orderSubmitResponse, err newOrder.Price, newOrder.Amount, newOrder.Side, - newOrder.Type) + newOrder.Type, + newOrder.Date) log.Debugln(log.OrderMgr, msg) - Bot.CommsManager.PushEvent(base.Event{ + o.orderStore.bot.CommsManager.PushEvent(base.Event{ Type: "order", Message: msg, }) @@ -413,6 +469,7 @@ func (o *orderManager) Submit(newOrder *order.Submit) (*orderSubmitResponse, err Date: time.Now(), LastUpdated: time.Now(), Pair: newOrder.Pair, + Leverage: newOrder.Leverage, }) if err != nil { return nil, fmt.Errorf("unable to add %v order %v to orderStore: %s", newOrder.Exchange, result.OrderID, err) @@ -428,13 +485,13 @@ func (o *orderManager) Submit(newOrder *order.Submit) (*orderSubmitResponse, err } func (o *orderManager) processOrders() { - authExchanges := Bot.GetAuthAPISupportedExchanges() + authExchanges := o.orderStore.bot.GetAuthAPISupportedExchanges() for x := range authExchanges { log.Debugf(log.OrderMgr, "Order manager: Processing orders for exchange %v.", authExchanges[x]) - exch := Bot.GetExchangeByName(authExchanges[x]) + exch := o.orderStore.bot.GetExchangeByName(authExchanges[x]) supportedAssets := exch.GetAssetTypes() for y := range supportedAssets { pairs, err := exch.GetEnabledPairs(supportedAssets[y]) @@ -448,7 +505,7 @@ func (o *orderManager) processOrders() { } if len(pairs) == 0 { - if Bot.Settings.Verbose { + if o.orderStore.bot.Settings.Verbose { log.Debugf(log.OrderMgr, "Order manager: No pairs enabled for %s and asset type %s, skipping...", authExchanges[x], @@ -480,7 +537,7 @@ func (o *orderManager) processOrders() { msg := fmt.Sprintf("Order manager: Exchange %s added order ID=%v pair=%v price=%v amount=%v side=%v type=%v.", ord.Exchange, ord.ID, ord.Pair, ord.Price, ord.Amount, ord.Side, ord.Type) log.Debugf(log.OrderMgr, "%v", msg) - Bot.CommsManager.PushEvent(base.Event{ + o.orderStore.bot.CommsManager.PushEvent(base.Event{ Type: "order", Message: msg, }) diff --git a/engine/orders_test.go b/engine/orders_test.go index 1e015a72..7cf87161 100644 --- a/engine/orders_test.go +++ b/engine/orders_test.go @@ -9,40 +9,36 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" ) -var ordersSetupRan bool - func OrdersSetup(t *testing.T) *Engine { - bot := SetupTestHelpers(t) - if !ordersSetupRan { - err := bot.OrderManager.Start() - if err != nil { - t.Fatal(err) - } - if !bot.OrderManager.Started() { - t.Fatal("Order manager not started") - } - ordersSetupRan = true + bot := CreateTestBot(t) + err := bot.OrderManager.Start(bot) + if err != nil { + t.Fatal(err) + } + bot.ServicesWG.Wait() + if !bot.OrderManager.Started() { + t.Fatal("Order manager not started") } return bot } func TestOrdersGet(t *testing.T) { - OrdersSetup(t) - if Bot.OrderManager.orderStore.get() == nil { + bot := OrdersSetup(t) + if bot.OrderManager.orderStore.get() == nil { t.Error("orderStore not established") } } func TestOrdersAdd(t *testing.T) { - OrdersSetup(t) - err := Bot.OrderManager.orderStore.Add(&order.Detail{ + bot := OrdersSetup(t) + err := bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestOrdersAdd", }) if err != nil { t.Error(err) } - err = Bot.OrderManager.orderStore.Add(&order.Detail{ + err = bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: "testTest", ID: "TestOrdersAdd", }) @@ -50,12 +46,12 @@ func TestOrdersAdd(t *testing.T) { t.Error("Expected error from non existent exchange") } - err = Bot.OrderManager.orderStore.Add(nil) + err = bot.OrderManager.orderStore.Add(nil) if err == nil { t.Error("Expected error from nil order") } - err = Bot.OrderManager.orderStore.Add(&order.Detail{ + err = bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestOrdersAdd", }) @@ -65,8 +61,8 @@ func TestOrdersAdd(t *testing.T) { } func TestGetByInternalOrderID(t *testing.T) { - OrdersSetup(t) - err := Bot.OrderManager.orderStore.Add(&order.Detail{ + bot := OrdersSetup(t) + err := bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestGetByInternalOrderID", InternalOrderID: "internalTest", @@ -75,7 +71,7 @@ func TestGetByInternalOrderID(t *testing.T) { t.Error(err) } - o, err := Bot.OrderManager.orderStore.GetByInternalOrderID("internalTest") + o, err := bot.OrderManager.orderStore.GetByInternalOrderID("internalTest") if err != nil { t.Error(err) } @@ -86,15 +82,15 @@ func TestGetByInternalOrderID(t *testing.T) { t.Error("Expected to retrieve order") } - _, err = Bot.OrderManager.orderStore.GetByInternalOrderID("NoOrder") + _, err = bot.OrderManager.orderStore.GetByInternalOrderID("NoOrder") if err != ErrOrderNotFound { t.Error(err) } } func TestGetByExchange(t *testing.T) { - OrdersSetup(t) - err := Bot.OrderManager.orderStore.Add(&order.Detail{ + bot := OrdersSetup(t) + err := bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestGetByExchange", InternalOrderID: "internalTestGetByExchange", @@ -103,7 +99,7 @@ func TestGetByExchange(t *testing.T) { t.Error(err) } - err = Bot.OrderManager.orderStore.Add(&order.Detail{ + err = bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestGetByExchange2", InternalOrderID: "internalTestGetByExchange2", @@ -112,7 +108,7 @@ func TestGetByExchange(t *testing.T) { t.Error(err) } - err = Bot.OrderManager.orderStore.Add(&order.Detail{ + err = bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: fakePassExchange, ID: "TestGetByExchange3", InternalOrderID: "internalTest3", @@ -121,7 +117,7 @@ func TestGetByExchange(t *testing.T) { t.Error(err) } var o []*order.Detail - o, err = Bot.OrderManager.orderStore.GetByExchange(testExchange) + o, err = bot.OrderManager.orderStore.GetByExchange(testExchange) if err != nil { t.Error(err) } @@ -141,11 +137,11 @@ func TestGetByExchange(t *testing.T) { t.Error("Expected orders 'TestGetByExchange' and 'TestGetByExchange2' to be returned") } - _, err = Bot.OrderManager.orderStore.GetByInternalOrderID("NoOrder") + _, err = bot.OrderManager.orderStore.GetByInternalOrderID("NoOrder") if err != ErrOrderNotFound { t.Error(err) } - err = Bot.OrderManager.orderStore.Add(&order.Detail{ + err = bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: "thisWillFail", }) if err == nil { @@ -154,8 +150,8 @@ func TestGetByExchange(t *testing.T) { } func TestGetByExchangeAndID(t *testing.T) { - OrdersSetup(t) - err := Bot.OrderManager.orderStore.Add(&order.Detail{ + bot := OrdersSetup(t) + err := bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestGetByExchangeAndID", }) @@ -163,7 +159,7 @@ func TestGetByExchangeAndID(t *testing.T) { t.Error(err) } - o, err := Bot.OrderManager.orderStore.GetByExchangeAndID(testExchange, "TestGetByExchangeAndID") + o, err := bot.OrderManager.orderStore.GetByExchangeAndID(testExchange, "TestGetByExchangeAndID") if err != nil { t.Error(err) } @@ -171,63 +167,63 @@ func TestGetByExchangeAndID(t *testing.T) { t.Error("Expected to retrieve order") } - _, err = Bot.OrderManager.orderStore.GetByExchangeAndID("", "TestGetByExchangeAndID") + _, err = bot.OrderManager.orderStore.GetByExchangeAndID("", "TestGetByExchangeAndID") if err != ErrExchangeNotFound { t.Error(err) } - _, err = Bot.OrderManager.orderStore.GetByExchangeAndID(testExchange, "") + _, err = bot.OrderManager.orderStore.GetByExchangeAndID(testExchange, "") if err != ErrOrderNotFound { t.Error(err) } } func TestExists(t *testing.T) { - OrdersSetup(t) - if Bot.OrderManager.orderStore.exists(nil) { + bot := OrdersSetup(t) + if bot.OrderManager.orderStore.exists(nil) { t.Error("Expected false") } o := &order.Detail{ Exchange: testExchange, ID: "TestExists", } - err := Bot.OrderManager.orderStore.Add(o) + err := bot.OrderManager.orderStore.Add(o) if err != nil { t.Error(err) } - b := Bot.OrderManager.orderStore.exists(o) + b := bot.OrderManager.orderStore.exists(o) if !b { t.Error("Expected true") } } func TestCancelOrder(t *testing.T) { - OrdersSetup(t) - err := Bot.OrderManager.Cancel(nil) + bot := OrdersSetup(t) + err := bot.OrderManager.Cancel(nil) if err == nil { t.Error("Expected error due to empty order") } - err = Bot.OrderManager.Cancel(&order.Cancel{}) + err = bot.OrderManager.Cancel(&order.Cancel{}) if err == nil { t.Error("Expected error due to empty order") } - err = Bot.OrderManager.Cancel(&order.Cancel{ + err = bot.OrderManager.Cancel(&order.Cancel{ Exchange: testExchange, }) if err == nil { t.Error("Expected error due to no order ID") } - err = Bot.OrderManager.Cancel(&order.Cancel{ + err = bot.OrderManager.Cancel(&order.Cancel{ ID: "ID", }) if err == nil { t.Error("Expected error due to no Exchange") } - err = Bot.OrderManager.Cancel(&order.Cancel{ + err = bot.OrderManager.Cancel(&order.Cancel{ ID: "ID", Exchange: testExchange, AssetType: asset.Binary, @@ -241,12 +237,12 @@ func TestCancelOrder(t *testing.T) { ID: "TestCancelOrder", Status: order.New, } - err = Bot.OrderManager.orderStore.Add(o) + err = bot.OrderManager.orderStore.Add(o) if err != nil { t.Error(err) } - err = Bot.OrderManager.Cancel(&order.Cancel{ + err = bot.OrderManager.Cancel(&order.Cancel{ ID: "Unknown", Exchange: fakePassExchange, AssetType: asset.Spot, @@ -269,7 +265,7 @@ func TestCancelOrder(t *testing.T) { Date: time.Now(), Pair: pair, } - err = Bot.OrderManager.Cancel(cancel) + err = bot.OrderManager.Cancel(cancel) if err != nil { t.Error(err) } @@ -280,14 +276,14 @@ func TestCancelOrder(t *testing.T) { } func TestGetOrderInfo(t *testing.T) { - OrdersSetup(t) - _, err := Bot.OrderManager.GetOrderInfo("", "", currency.Pair{}, "") + bot := OrdersSetup(t) + _, err := bot.OrderManager.GetOrderInfo("", "", currency.Pair{}, "") if err == nil { t.Error("Expected error due to empty order") } var result order.Detail - result, err = Bot.OrderManager.GetOrderInfo(fakePassExchange, "1234", currency.Pair{}, "") + result, err = bot.OrderManager.GetOrderInfo(fakePassExchange, "1234", currency.Pair{}, "") if err != nil { t.Error(err) } @@ -295,7 +291,7 @@ func TestGetOrderInfo(t *testing.T) { t.Error("unexpected order returned") } - result, err = Bot.OrderManager.GetOrderInfo(fakePassExchange, "1234", currency.Pair{}, "") + result, err = bot.OrderManager.GetOrderInfo(fakePassExchange, "1234", currency.Pair{}, "") if err != nil { t.Error(err) } @@ -305,37 +301,37 @@ func TestGetOrderInfo(t *testing.T) { } func TestCancelAllOrders(t *testing.T) { - OrdersSetup(t) + bot := OrdersSetup(t) o := &order.Detail{ Exchange: fakePassExchange, ID: "TestCancelAllOrders", Status: order.New, } - err := Bot.OrderManager.orderStore.Add(o) + err := bot.OrderManager.orderStore.Add(o) if err != nil { t.Error(err) } - Bot.OrderManager.CancelAllOrders([]string{"NotFound"}) + bot.OrderManager.CancelAllOrders([]string{"NotFound"}) if o.Status == order.Cancelled { t.Error("Order should not be cancelled") } - Bot.OrderManager.CancelAllOrders([]string{fakePassExchange}) + bot.OrderManager.CancelAllOrders([]string{fakePassExchange}) if o.Status != order.Cancelled { t.Error("Order should be cancelled") } o.Status = order.New - Bot.OrderManager.CancelAllOrders(nil) + bot.OrderManager.CancelAllOrders(nil) if o.Status != order.New { t.Error("Order should not be cancelled") } } func TestSubmit(t *testing.T) { - OrdersSetup(t) - _, err := Bot.OrderManager.Submit(nil) + bot := OrdersSetup(t) + _, err := bot.OrderManager.Submit(nil) if err == nil { t.Error("Expected error from nil order") } @@ -346,13 +342,13 @@ func TestSubmit(t *testing.T) { Status: order.New, Type: order.Market, } - _, err = Bot.OrderManager.Submit(o) + _, err = bot.OrderManager.Submit(o) if err == nil { t.Error("Expected error from empty exchange") } o.Exchange = fakePassExchange - _, err = Bot.OrderManager.Submit(o) + _, err = bot.OrderManager.Submit(o) if err == nil { t.Error("Expected error from validation") } @@ -362,27 +358,27 @@ func TestSubmit(t *testing.T) { t.Fatal(err) } - Bot.OrderManager.cfg.EnforceLimitConfig = true - Bot.OrderManager.cfg.AllowMarketOrders = false + bot.OrderManager.cfg.EnforceLimitConfig = true + bot.OrderManager.cfg.AllowMarketOrders = false o.Pair = pair o.AssetType = asset.Spot o.Side = order.Buy o.Amount = 1 o.Price = 1 - _, err = Bot.OrderManager.Submit(o) + _, err = bot.OrderManager.Submit(o) if err == nil { t.Error("Expected fail due to order market type is not allowed") } - Bot.OrderManager.cfg.AllowMarketOrders = true - Bot.OrderManager.cfg.LimitAmount = 1 + bot.OrderManager.cfg.AllowMarketOrders = true + bot.OrderManager.cfg.LimitAmount = 1 o.Amount = 2 - _, err = Bot.OrderManager.Submit(o) + _, err = bot.OrderManager.Submit(o) if err == nil { t.Error("Expected fail due to order limit exceeds allowed limit") } - Bot.OrderManager.cfg.LimitAmount = 0 - Bot.OrderManager.cfg.AllowedExchanges = []string{"fake"} - _, err = Bot.OrderManager.Submit(o) + bot.OrderManager.cfg.LimitAmount = 0 + bot.OrderManager.cfg.AllowedExchanges = []string{"fake"} + _, err = bot.OrderManager.Submit(o) if err == nil { t.Error("Expected fail due to order exchange not found in allowed list") } @@ -392,20 +388,20 @@ func TestSubmit(t *testing.T) { t.Fatal(err) } - Bot.OrderManager.cfg.AllowedExchanges = nil - Bot.OrderManager.cfg.AllowedPairs = currency.Pairs{failPair} - _, err = Bot.OrderManager.Submit(o) + bot.OrderManager.cfg.AllowedExchanges = nil + bot.OrderManager.cfg.AllowedPairs = currency.Pairs{failPair} + _, err = bot.OrderManager.Submit(o) if err == nil { t.Error("Expected fail due to order pair not found in allowed list") } - Bot.OrderManager.cfg.AllowedPairs = nil - _, err = Bot.OrderManager.Submit(o) + bot.OrderManager.cfg.AllowedPairs = nil + _, err = bot.OrderManager.Submit(o) if err != nil { t.Error(err) } - o2, err := Bot.OrderManager.orderStore.GetByExchangeAndID(fakePassExchange, "FakePassingExchangeOrder") + o2, err := bot.OrderManager.orderStore.GetByExchangeAndID(fakePassExchange, "FakePassingExchangeOrder") if err != nil { t.Error(err) } @@ -415,6 +411,6 @@ func TestSubmit(t *testing.T) { } func TestProcessOrders(t *testing.T) { - OrdersSetup(t) - Bot.OrderManager.processOrders() + bot := OrdersSetup(t) + bot.OrderManager.processOrders() } diff --git a/engine/orders_types.go b/engine/orders_types.go index 0b0361a2..404b9b2e 100644 --- a/engine/orders_types.go +++ b/engine/orders_types.go @@ -25,6 +25,7 @@ type orderManagerConfig struct { type orderStore struct { m sync.RWMutex Orders map[string][]*order.Detail + bot *Engine } type orderManager struct { diff --git a/engine/restful_server.go b/engine/restful_server.go index 792e35ab..da0b03cc 100644 --- a/engine/restful_server.go +++ b/engine/restful_server.go @@ -25,7 +25,7 @@ func RESTfulError(method string, err error) { // RESTGetAllSettings replies to a request with an encoded JSON response about the // trading Bots configuration. func RESTGetAllSettings(w http.ResponseWriter, r *http.Request) { - err := RESTfulJSONResponse(w, Bot.Config) + err := RESTfulJSONResponse(w, config.Cfg) if err != nil { RESTfulError(r.Method, err) } diff --git a/engine/restful_server_test.go b/engine/restful_server_test.go index 28bc73d3..7501ab3b 100644 --- a/engine/restful_server_test.go +++ b/engine/restful_server_test.go @@ -24,8 +24,8 @@ func makeHTTPGetRequest(t *testing.T, response interface{}) *http.Response { // TestConfigAllJsonResponse test if config/all restful json response is valid func TestConfigAllJsonResponse(t *testing.T) { - SetupTestHelpers(t) - resp := makeHTTPGetRequest(t, Bot.Config) + bot := CreateTestBot(t) + resp := makeHTTPGetRequest(t, bot.Config) body, err := ioutil.ReadAll(resp.Body) resp.Body.Close() if err != nil { @@ -38,13 +38,13 @@ func TestConfigAllJsonResponse(t *testing.T) { t.Error("Response not parseable as json", err) } - if reflect.DeepEqual(responseConfig, Bot.Config) { + if reflect.DeepEqual(responseConfig, bot.Config) { t.Error("Json not equal to config") } } func TestInvalidHostRequest(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) req, err := http.NewRequest(http.MethodGet, "/config/all", nil) if err != nil { t.Fatal(err) @@ -60,7 +60,10 @@ func TestInvalidHostRequest(t *testing.T) { } func TestValidHostRequest(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) + if config.Cfg.Name == "" { + config.Cfg = *e.Config + } req, err := http.NewRequest(http.MethodGet, "/config/all", nil) if err != nil { t.Fatal(err) @@ -76,7 +79,7 @@ func TestValidHostRequest(t *testing.T) { } func TestProfilerEnabledShouldEnableProfileEndPoint(t *testing.T) { - e := SetupTestHelpers(t) + e := CreateTestBot(t) req, err := http.NewRequest(http.MethodGet, "/debug/pprof/", nil) if err != nil { t.Fatal(err) @@ -89,8 +92,8 @@ func TestProfilerEnabledShouldEnableProfileEndPoint(t *testing.T) { t.Errorf("Response returned wrong status code expected %v got %v", http.StatusNotFound, status) } - Bot.Config.Profiler.Enabled = true - Bot.Config.Profiler.MutexProfileFraction = 5 + e.Config.Profiler.Enabled = true + e.Config.Profiler.MutexProfileFraction = 5 req, err = http.NewRequest(http.MethodGet, "/debug/pprof/", nil) if err != nil { t.Fatal(err) diff --git a/engine/routines.go b/engine/routines.go index 46520372..1789cec1 100644 --- a/engine/routines.go +++ b/engine/routines.go @@ -17,8 +17,8 @@ import ( "github.com/thrasher-corp/gocryptotrader/log" ) -func printCurrencyFormat(price float64) string { - displaySymbol, err := currency.GetSymbolByCurrencyName(Bot.Config.Currency.FiatDisplayCurrency) +func printCurrencyFormat(price float64, displayCurrency currency.Code) string { + displaySymbol, err := currency.GetSymbolByCurrencyName(displayCurrency) if err != nil { log.Errorf(log.Global, "Failed to get display symbol: %s\n", err) } @@ -26,8 +26,7 @@ func printCurrencyFormat(price float64) string { return fmt.Sprintf("%s%.8f", displaySymbol, price) } -func printConvertCurrencyFormat(origCurrency currency.Code, origPrice float64) string { - displayCurrency := Bot.Config.Currency.FiatDisplayCurrency +func printConvertCurrencyFormat(origCurrency currency.Code, origPrice float64, displayCurrency currency.Code) string { conv, err := currency.ConvertCurrency(origPrice, origCurrency, displayCurrency) @@ -73,38 +72,40 @@ func printTickerSummary(result *ticker.Price, protocol string, err error) { stats.Add(result.ExchangeName, result.Pair, result.AssetType, result.Last, result.Volume) if result.Pair.Quote.IsFiatCurrency() && + Bot != nil && result.Pair.Quote != Bot.Config.Currency.FiatDisplayCurrency { origCurrency := result.Pair.Quote.Upper() log.Infof(log.Ticker, "%s %s %s %s: TICKER: Last %s Ask %s Bid %s High %s Low %s Volume %.8f\n", result.ExchangeName, protocol, - FormatCurrency(result.Pair), + Bot.FormatCurrency(result.Pair), strings.ToUpper(result.AssetType.String()), - printConvertCurrencyFormat(origCurrency, result.Last), - printConvertCurrencyFormat(origCurrency, result.Ask), - printConvertCurrencyFormat(origCurrency, result.Bid), - printConvertCurrencyFormat(origCurrency, result.High), - printConvertCurrencyFormat(origCurrency, result.Low), + printConvertCurrencyFormat(origCurrency, result.Last, Bot.Config.Currency.FiatDisplayCurrency), + printConvertCurrencyFormat(origCurrency, result.Ask, Bot.Config.Currency.FiatDisplayCurrency), + printConvertCurrencyFormat(origCurrency, result.Bid, Bot.Config.Currency.FiatDisplayCurrency), + printConvertCurrencyFormat(origCurrency, result.High, Bot.Config.Currency.FiatDisplayCurrency), + printConvertCurrencyFormat(origCurrency, result.Low, Bot.Config.Currency.FiatDisplayCurrency), result.Volume) } else { if result.Pair.Quote.IsFiatCurrency() && + Bot != nil && result.Pair.Quote == Bot.Config.Currency.FiatDisplayCurrency { log.Infof(log.Ticker, "%s %s %s %s: TICKER: Last %s Ask %s Bid %s High %s Low %s Volume %.8f\n", result.ExchangeName, protocol, - FormatCurrency(result.Pair), + Bot.FormatCurrency(result.Pair), strings.ToUpper(result.AssetType.String()), - printCurrencyFormat(result.Last), - printCurrencyFormat(result.Ask), - printCurrencyFormat(result.Bid), - printCurrencyFormat(result.High), - printCurrencyFormat(result.Low), + printCurrencyFormat(result.Last, Bot.Config.Currency.FiatDisplayCurrency), + printCurrencyFormat(result.Ask, Bot.Config.Currency.FiatDisplayCurrency), + printCurrencyFormat(result.Bid, Bot.Config.Currency.FiatDisplayCurrency), + printCurrencyFormat(result.High, Bot.Config.Currency.FiatDisplayCurrency), + printCurrencyFormat(result.Low, Bot.Config.Currency.FiatDisplayCurrency), result.Volume) } else { log.Infof(log.Ticker, "%s %s %s %s: TICKER: Last %.8f Ask %.8f Bid %.8f High %.8f Low %.8f Volume %.8f\n", result.ExchangeName, protocol, - FormatCurrency(result.Pair), + Bot.FormatCurrency(result.Pair), strings.ToUpper(result.AssetType.String()), result.Last, result.Ask, @@ -120,7 +121,7 @@ const ( book = "%s %s %s %s: ORDERBOOK: Bids len: %d Amount: %f %s. Total value: %s Asks len: %d Amount: %f %s. Total value: %s\n" ) -func printOrderbookSummary(result *orderbook.Base, protocol string, err error) { +func printOrderbookSummary(result *orderbook.Base, protocol string, bot *Engine, err error) { if err != nil { if result == nil { log.Errorf(log.OrderBook, "Failed to get %s orderbook. Error: %s\n", @@ -151,21 +152,22 @@ func printOrderbookSummary(result *orderbook.Base, protocol string, err error) { var bidValueResult, askValueResult string switch { - case result.Pair.Quote.IsFiatCurrency() && result.Pair.Quote != Bot.Config.Currency.FiatDisplayCurrency: + case result.Pair.Quote.IsFiatCurrency() && bot != nil && result.Pair.Quote != bot.Config.Currency.FiatDisplayCurrency: origCurrency := result.Pair.Quote.Upper() - bidValueResult = printConvertCurrencyFormat(origCurrency, bidsValue) - askValueResult = printConvertCurrencyFormat(origCurrency, asksValue) - case result.Pair.Quote.IsFiatCurrency() && result.Pair.Quote == Bot.Config.Currency.FiatDisplayCurrency: - bidValueResult = printCurrencyFormat(bidsValue) - askValueResult = printCurrencyFormat(asksValue) + bidValueResult = printConvertCurrencyFormat(origCurrency, bidsValue, bot.Config.Currency.FiatDisplayCurrency) + askValueResult = printConvertCurrencyFormat(origCurrency, asksValue, bot.Config.Currency.FiatDisplayCurrency) + case result.Pair.Quote.IsFiatCurrency() && bot != nil && result.Pair.Quote == bot.Config.Currency.FiatDisplayCurrency: + bidValueResult = printCurrencyFormat(bidsValue, bot.Config.Currency.FiatDisplayCurrency) + askValueResult = printCurrencyFormat(asksValue, bot.Config.Currency.FiatDisplayCurrency) default: bidValueResult = strconv.FormatFloat(bidsValue, 'f', -1, 64) askValueResult = strconv.FormatFloat(asksValue, 'f', -1, 64) } + log.Infof(log.OrderBook, book, result.ExchangeName, protocol, - FormatCurrency(result.Pair), + bot.FormatCurrency(result.Pair), strings.ToUpper(result.AssetType.String()), len(result.Bids), bidsAmount, @@ -289,7 +291,7 @@ func (bot *Engine) WebsocketDataHandler(exchName string, data interface{}) error if bot.Settings.Verbose { log.Infof(log.WebsocketMgr, "%s websocket %s %s funding updated %+v", exchName, - FormatCurrency(d.CurrencyPair), + bot.FormatCurrency(d.CurrencyPair), d.AssetType, d) } @@ -307,7 +309,7 @@ func (bot *Engine) WebsocketDataHandler(exchName string, data interface{}) error if bot.Settings.Verbose { log.Infof(log.WebsocketMgr, "%s websocket %s %s kline updated %+v", exchName, - FormatCurrency(d.Pair), + bot.FormatCurrency(d.Pair), d.AssetType, d) } @@ -319,7 +321,7 @@ func (bot *Engine) WebsocketDataHandler(exchName string, data interface{}) error SyncItemOrderbook, nil) } - printOrderbookSummary(d, "websocket", nil) + printOrderbookSummary(d, "websocket", bot, nil) case *order.Detail: if !bot.OrderManager.orderStore.exists(d) { err := bot.OrderManager.orderStore.Add(d) diff --git a/engine/routines_test.go b/engine/routines_test.go index 321f6bc2..a691116d 100644 --- a/engine/routines_test.go +++ b/engine/routines_test.go @@ -15,7 +15,8 @@ import ( func TestWebsocketDataHandlerProcess(t *testing.T) { ws := sharedtestvalues.NewTestWebsocket() - go Bot.WebsocketDataReceiver(ws) + b := OrdersSetup(t) + go b.WebsocketDataReceiver(ws) ws.DataHandler <- "string" time.Sleep(time.Second) close(shutdowner) @@ -112,7 +113,7 @@ func TestHandleData(t *testing.T) { if err == nil { t.Error("Expected error") } - if err.Error() != classificationError.Error() { + if err != nil && err.Error() != classificationError.Error() { t.Errorf("Problem formatting error. Expected %v Received %v", classificationError.Error(), err.Error()) } diff --git a/engine/rpcserver.go b/engine/rpcserver.go index 85caff0c..de17629a 100644 --- a/engine/rpcserver.go +++ b/engine/rpcserver.go @@ -49,20 +49,16 @@ import ( "google.golang.org/grpc/metadata" ) -const ( - errExchangeNameUnset = "exchange name unset" - errAssetTypeUnset = "asset type unset" - errDispatchSystem = "dispatch system offline" - invalidArguments = "invalid arguments received" -) - var ( errExchangeNotLoaded = errors.New("exchange is not loaded/doesn't exist") errExchangeBaseNotFound = errors.New("cannot get exchange base") - errInvalidArguments = errors.New(invalidArguments) + errInvalidArguments = errors.New("invalid arguments received") + errExchangeNameUnset = errors.New("exchange name unset") errCurrencyPairUnset = errors.New("currency pair unset") + errStartEndTimesUnset = errors.New("invalid start and end times") + errAssetTypeUnset = errors.New("asset type unset") + errDispatchSystem = errors.New("dispatch system offline") errCurrencyNotEnabled = errors.New("currency not enabled") - errInvalidStartEndTime = errors.New("invalid start and end times") ) // RPCServer struct @@ -557,7 +553,7 @@ func createAccountInfoRequest(h account.Holdings) (*gctrpc.GetAccountInfoRespons // GetAccountInfoStream streams an account balance for a specific exchange func (s *RPCServer) GetAccountInfoStream(r *gctrpc.GetAccountInfoRequest, stream gctrpc.GoCryptoTrader_GetAccountInfoStreamServer) error { if r.Exchange == "" { - return errors.New(errExchangeNameUnset) + return errExchangeNameUnset } exch := s.GetExchangeByName(r.Exchange) @@ -609,7 +605,7 @@ func (s *RPCServer) GetAccountInfoStream(r *gctrpc.GetAccountInfoRequest, stream for { data, ok := <-pipe.C if !ok { - return errors.New(errDispatchSystem) + return errDispatchSystem } acc := (*data.(*interface{})).(account.Holdings) @@ -832,7 +828,7 @@ func (s *RPCServer) GetOrders(_ context.Context, r *gctrpc.GetOrdersRequest) (*g } } if !start.IsZero() && !end.IsZero() && start.After(end) { - return nil, errInvalidStartEndTime + return nil, errStartEndTimesUnset } cp := currency.NewPairWithDelimiter( @@ -1299,7 +1295,7 @@ func (s *RPCServer) WithdrawCryptocurrencyFunds(_ context.Context, r *gctrpc.Wit }, } - resp, err := SubmitWithdrawal(request) + resp, err := s.Engine.SubmitWithdrawal(request) if err != nil { return nil, err } @@ -1341,7 +1337,7 @@ func (s *RPCServer) WithdrawFiatFunds(_ context.Context, r *gctrpc.WithdrawFiatR }, } - resp, err := SubmitWithdrawal(request) + resp, err := s.Engine.SubmitWithdrawal(request) if err != nil { return nil, err } @@ -1627,7 +1623,7 @@ func (s *RPCServer) SetExchangePair(_ context.Context, r *gctrpc.SetExchangePair // GetOrderbookStream streams the requested updated orderbook func (s *RPCServer) GetOrderbookStream(r *gctrpc.GetOrderbookStreamRequest, stream gctrpc.GoCryptoTrader_GetOrderbookStreamServer) error { if r.Exchange == "" { - return errors.New(errExchangeNameUnset) + return errExchangeNameUnset } if r.Pair.String() == "" { @@ -1635,7 +1631,7 @@ func (s *RPCServer) GetOrderbookStream(r *gctrpc.GetOrderbookStreamRequest, stre } if r.AssetType == "" { - return errors.New(errAssetTypeUnset) + return errAssetTypeUnset } p, err := currency.NewPairFromStrings(r.Pair.Base, r.Pair.Quote) @@ -1658,7 +1654,7 @@ func (s *RPCServer) GetOrderbookStream(r *gctrpc.GetOrderbookStreamRequest, stre for { data, ok := <-pipe.C if !ok { - return errors.New(errDispatchSystem) + return errDispatchSystem } ob := (*data.(*interface{})).(orderbook.Base) @@ -1693,7 +1689,7 @@ func (s *RPCServer) GetOrderbookStream(r *gctrpc.GetOrderbookStreamRequest, stre // GetExchangeOrderbookStream streams all orderbooks associated with an exchange func (s *RPCServer) GetExchangeOrderbookStream(r *gctrpc.GetExchangeOrderbookStreamRequest, stream gctrpc.GoCryptoTrader_GetExchangeOrderbookStreamServer) error { if r.Exchange == "" { - return errors.New(errExchangeNameUnset) + return errExchangeNameUnset } pipe, err := orderbook.SubscribeToExchangeOrderbooks(r.Exchange) @@ -1706,7 +1702,7 @@ func (s *RPCServer) GetExchangeOrderbookStream(r *gctrpc.GetExchangeOrderbookStr for { data, ok := <-pipe.C if !ok { - return errors.New(errDispatchSystem) + return errDispatchSystem } ob := (*data.(*interface{})).(orderbook.Base) @@ -1741,7 +1737,7 @@ func (s *RPCServer) GetExchangeOrderbookStream(r *gctrpc.GetExchangeOrderbookStr // GetTickerStream streams the requested updated ticker func (s *RPCServer) GetTickerStream(r *gctrpc.GetTickerStreamRequest, stream gctrpc.GoCryptoTrader_GetTickerStreamServer) error { if r.Exchange == "" { - return errors.New(errExchangeNameUnset) + return errExchangeNameUnset } if r.Pair.String() == "" { @@ -1749,7 +1745,7 @@ func (s *RPCServer) GetTickerStream(r *gctrpc.GetTickerStreamRequest, stream gct } if r.AssetType == "" { - return errors.New(errAssetTypeUnset) + return errAssetTypeUnset } p, err := currency.NewPairFromStrings(r.Pair.Base, r.Pair.Quote) @@ -1772,7 +1768,7 @@ func (s *RPCServer) GetTickerStream(r *gctrpc.GetTickerStreamRequest, stream gct for { data, ok := <-pipe.C if !ok { - return errors.New(errDispatchSystem) + return errDispatchSystem } t := (*data.(*interface{})).(ticker.Price) @@ -1799,7 +1795,7 @@ func (s *RPCServer) GetTickerStream(r *gctrpc.GetTickerStreamRequest, stream gct // GetExchangeTickerStream streams all tickers associated with an exchange func (s *RPCServer) GetExchangeTickerStream(r *gctrpc.GetExchangeTickerStreamRequest, stream gctrpc.GoCryptoTrader_GetExchangeTickerStreamServer) error { if r.Exchange == "" { - return errors.New(errExchangeNameUnset) + return errExchangeNameUnset } pipe, err := ticker.SubscribeToExchangeTickers(r.Exchange) @@ -1812,7 +1808,7 @@ func (s *RPCServer) GetExchangeTickerStream(r *gctrpc.GetExchangeTickerStreamReq for { data, ok := <-pipe.C if !ok { - return errors.New(errDispatchSystem) + return errDispatchSystem } t := (*data.(*interface{})).(ticker.Price) @@ -1884,13 +1880,13 @@ func (s *RPCServer) GetAuditEvent(_ context.Context, r *gctrpc.GetAuditEventRequ // GetHistoricCandles returns historical candles for a given exchange func (s *RPCServer) GetHistoricCandles(_ context.Context, r *gctrpc.GetHistoricCandlesRequest) (*gctrpc.GetHistoricCandlesResponse, error) { if r.Exchange == "" { - return nil, fmt.Errorf("%w. blank exchange name received", errInvalidArguments) + return nil, errExchangeNameUnset } if r.Pair.String() == "" { return nil, errCurrencyPairUnset } if r.Start == r.End { - return nil, errInvalidStartEndTime + return nil, errStartEndTimesUnset } var klineItem kline.Item diff --git a/engine/rpcserver_test.go b/engine/rpcserver_test.go index 99fb63a8..d8b4af68 100644 --- a/engine/rpcserver_test.go +++ b/engine/rpcserver_test.go @@ -331,8 +331,8 @@ func TestGetHistoricCandles(t *testing.T) { _, err := s.GetHistoricCandles(context.Background(), &gctrpc.GetHistoricCandlesRequest{ Exchange: "", }) - if !errors.Is(err, errInvalidArguments) { - t.Errorf("expected %v, received %v", errInvalidArguments, err) + if !errors.Is(err, errExchangeNameUnset) { + t.Errorf("expected %v, received %v", errExchangeNameUnset, err) } _, err = s.GetHistoricCandles(context.Background(), &gctrpc.GetHistoricCandlesRequest{ @@ -349,8 +349,8 @@ func TestGetHistoricCandles(t *testing.T) { Quote: currency.USD.String(), }, }) - if !errors.Is(err, errInvalidStartEndTime) { - t.Errorf("expected %v, received %v", errInvalidStartEndTime, err) + if !errors.Is(err, errStartEndTimesUnset) { + t.Errorf("expected %v, received %v", errStartEndTimesUnset, err) } var results *gctrpc.GetHistoricCandlesResponse defaultStart := time.Date(2020, 1, 1, 1, 1, 1, 1, time.UTC) @@ -788,7 +788,7 @@ func TestGetHistoricTrades(t *testing.T) { } func TestGetAccountInfo(t *testing.T) { - bot := SetupTestHelpers(t) + bot := CreateTestBot(t) s := RPCServer{Engine: bot} r, err := s.GetAccountInfo(context.Background(), &gctrpc.GetAccountInfoRequest{Exchange: fakePassExchange, AssetType: asset.Spot.String()}) @@ -802,7 +802,7 @@ func TestGetAccountInfo(t *testing.T) { } func TestUpdateAccountInfo(t *testing.T) { - bot := SetupTestHelpers(t) + bot := CreateTestBot(t) s := RPCServer{Engine: bot} getResponse, err := s.GetAccountInfo(context.Background(), &gctrpc.GetAccountInfoRequest{Exchange: fakePassExchange, AssetType: asset.Spot.String()}) @@ -868,8 +868,8 @@ func TestGetOrders(t *testing.T) { StartDate: time.Now().Format(common.SimpleTimeFormat), EndDate: time.Now().Add(-time.Hour).Format(common.SimpleTimeFormat), }) - if !errors.Is(err, errInvalidStartEndTime) { - t.Errorf("expected %v, received %v", errInvalidStartEndTime, err) + if !errors.Is(err, errStartEndTimesUnset) { + t.Errorf("expected %v, received %v", errStartEndTimesUnset, err) } _, err = s.GetOrders(context.Background(), &gctrpc.GetOrdersRequest{ @@ -966,10 +966,7 @@ func TestGetOrder(t *testing.T) { if !errors.Is(err, errOrderCannotBeEmpty) { t.Errorf("expected %v, received %v", errOrderCannotBeEmpty, err) } - if Bot == nil { - Bot = engerino - } - err = Bot.OrderManager.Start() + err = engerino.OrderManager.Start(engerino) if err != nil { t.Fatal(err) } diff --git a/engine/syncer.go b/engine/syncer.go index 7bedca47..87a1a65d 100644 --- a/engine/syncer.go +++ b/engine/syncer.go @@ -99,7 +99,7 @@ func (e *ExchangeCurrencyPairSyncer) add(c *CurrencyPairSyncAgent) { if e.Cfg.Verbose { log.Debugf(log.SyncMgr, "%s: Added ticker sync item %v: using websocket: %v using REST: %v\n", - c.Exchange, FormatCurrency(c.Pair).String(), c.Ticker.IsUsingWebsocket, + c.Exchange, Bot.FormatCurrency(c.Pair).String(), c.Ticker.IsUsingWebsocket, c.Ticker.IsUsingREST) } if atomic.LoadInt32(&e.initSyncCompleted) != 1 { @@ -112,7 +112,7 @@ func (e *ExchangeCurrencyPairSyncer) add(c *CurrencyPairSyncAgent) { if e.Cfg.Verbose { log.Debugf(log.SyncMgr, "%s: Added orderbook sync item %v: using websocket: %v using REST: %v\n", - c.Exchange, FormatCurrency(c.Pair).String(), c.Orderbook.IsUsingWebsocket, + c.Exchange, Bot.FormatCurrency(c.Pair).String(), c.Orderbook.IsUsingWebsocket, c.Orderbook.IsUsingREST) } if atomic.LoadInt32(&e.initSyncCompleted) != 1 { @@ -125,7 +125,7 @@ func (e *ExchangeCurrencyPairSyncer) add(c *CurrencyPairSyncAgent) { if e.Cfg.Verbose { log.Debugf(log.SyncMgr, "%s: Added trade sync item %v: using websocket: %v using REST: %v\n", - c.Exchange, FormatCurrency(c.Pair).String(), c.Trade.IsUsingWebsocket, + c.Exchange, Bot.FormatCurrency(c.Pair).String(), c.Trade.IsUsingWebsocket, c.Trade.IsUsingREST) } if atomic.LoadInt32(&e.initSyncCompleted) != 1 { @@ -239,7 +239,7 @@ func (e *ExchangeCurrencyPairSyncer) update(exchangeName string, p currency.Pair removedCounter++ log.Debugf(log.SyncMgr, "%s ticker sync complete %v [%d/%d].\n", exchangeName, - FormatCurrency(p).String(), + Bot.FormatCurrency(p).String(), removedCounter, createdCounter) e.initSyncWG.Done() @@ -257,7 +257,7 @@ func (e *ExchangeCurrencyPairSyncer) update(exchangeName string, p currency.Pair removedCounter++ log.Debugf(log.SyncMgr, "%s orderbook sync complete %v [%d/%d].\n", exchangeName, - FormatCurrency(p).String(), + Bot.FormatCurrency(p).String(), removedCounter, createdCounter) e.initSyncWG.Done() @@ -275,7 +275,7 @@ func (e *ExchangeCurrencyPairSyncer) update(exchangeName string, p currency.Pair removedCounter++ log.Debugf(log.SyncMgr, "%s trade sync complete %v [%d/%d].\n", exchangeName, - FormatCurrency(p).String(), + Bot.FormatCurrency(p).String(), removedCounter, createdCounter) e.initSyncWG.Done() @@ -377,7 +377,7 @@ func (e *ExchangeCurrencyPairSyncer) worker() { if switchedToRest && usingWebsocket { log.Warnf(log.SyncMgr, "%s %s: Websocket re-enabled, switching from rest to websocket\n", - c.Exchange, FormatCurrency(enabledPairs[i]).String()) + c.Exchange, Bot.FormatCurrency(enabledPairs[i]).String()) switchedToRest = false } if e.Cfg.SyncTicker { @@ -395,7 +395,7 @@ func (e *ExchangeCurrencyPairSyncer) worker() { log.Warnf(log.SyncMgr, "%s %s %s: No ticker update after %s, switching from websocket to rest\n", c.Exchange, - FormatCurrency(enabledPairs[i]).String(), + Bot.FormatCurrency(enabledPairs[i]).String(), strings.ToUpper(c.AssetType.String()), e.Cfg.SyncTimeout, ) @@ -462,7 +462,7 @@ func (e *ExchangeCurrencyPairSyncer) worker() { log.Warnf(log.SyncMgr, "%s %s %s: No orderbook update after %s, switching from websocket to rest\n", c.Exchange, - FormatCurrency(c.Pair).String(), + Bot.FormatCurrency(c.Pair).String(), strings.ToUpper(c.AssetType.String()), e.Cfg.SyncTimeout, ) @@ -473,7 +473,7 @@ func (e *ExchangeCurrencyPairSyncer) worker() { e.setProcessing(c.Exchange, c.Pair, c.AssetType, SyncItemOrderbook, true) result, err := exchanges[x].UpdateOrderbook(c.Pair, c.AssetType) - printOrderbookSummary(result, "REST", err) + printOrderbookSummary(result, "REST", Bot, err) if err == nil { if Bot.Config.RemoteControl.WebsocketRPC.Enabled { relayWebsocketEvent(result, "orderbook_update", c.AssetType.String(), exchangeName) diff --git a/engine/withdraw.go b/engine/withdraw.go index 16bd6a3d..07cdb126 100644 --- a/engine/withdraw.go +++ b/engine/withdraw.go @@ -23,12 +23,12 @@ const ( // SubmitWithdrawal performs validation and submits a new withdraw request to // exchange -func SubmitWithdrawal(req *withdraw.Request) (*withdraw.Response, error) { +func (bot *Engine) SubmitWithdrawal(req *withdraw.Request) (*withdraw.Response, error) { if req == nil { return nil, withdraw.ErrRequestCannotBeNil } - exch := Bot.GetExchangeByName(req.Exchange) + exch := bot.GetExchangeByName(req.Exchange) if exch == nil { return nil, ErrExchangeNotFound } @@ -41,7 +41,7 @@ func SubmitWithdrawal(req *withdraw.Request) (*withdraw.Response, error) { } var err error - if Bot.Settings.EnableDryRun { + if bot.Settings.EnableDryRun { log.Warnln(log.Global, "Dry run enabled, no withdrawal request will be submitted or have an event created") resp.ID = withdraw.DryRunID resp.Exchange.Status = "dryrun" diff --git a/engine/withdraw_test.go b/engine/withdraw_test.go index 6b664ff9..27c618ab 100644 --- a/engine/withdraw_test.go +++ b/engine/withdraw_test.go @@ -8,6 +8,7 @@ import ( "testing" "time" + "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" "github.com/thrasher-corp/gocryptotrader/portfolio/banking" "github.com/thrasher-corp/gocryptotrader/portfolio/withdraw" @@ -37,7 +38,10 @@ func cleanup() { } func TestSubmitWithdrawal(t *testing.T) { - SetupTestHelpers(t) + bot := CreateTestBot(t) + if config.Cfg.Name == "" { + config.Cfg = *bot.Config + } banking.Accounts = append(banking.Accounts, banking.Account{ Enabled: true, @@ -72,12 +76,12 @@ func TestSubmitWithdrawal(t *testing.T) { }, } - _, err = SubmitWithdrawal(req) + _, err = bot.SubmitWithdrawal(req) if err != nil { t.Fatal(err) } - _, err = SubmitWithdrawal(nil) + _, err = bot.SubmitWithdrawal(nil) if err != nil { if err.Error() != withdraw.ErrRequestCannotBeNil.Error() { t.Fatal(err) diff --git a/exchanges/binance/binance_test.go b/exchanges/binance/binance_test.go index 557b1ec7..f49cd912 100644 --- a/exchanges/binance/binance_test.go +++ b/exchanges/binance/binance_test.go @@ -2337,7 +2337,7 @@ func TestGetHistoricCandles(t *testing.T) { end := time.Unix(1577836799, 0) _, err = b.GetHistoricCandles(currencyPair, asset.Spot, startTime, end, kline.OneDay) if err != nil { - t.Fatal(err) + t.Error(err) } _, err = b.GetHistoricCandles(currencyPair, asset.Spot, startTime, end, kline.Interval(time.Hour*7)) @@ -2351,15 +2351,17 @@ func TestGetHistoricCandlesExtended(t *testing.T) { if err != nil { t.Fatal(err) } - startTime := time.Unix(1546300800, 0) - end := time.Unix(1577836799, 0) + + startTime := time.Date(2020, 9, 1, 0, 0, 0, 0, time.UTC) + end := time.Date(2021, 2, 15, 0, 0, 0, 0, time.UTC) _, err = b.GetHistoricCandlesExtended(currencyPair, asset.Spot, startTime, end, kline.OneDay) if err != nil { - t.Fatal(err) + t.Error(err) } + _, err = b.GetHistoricCandlesExtended(currencyPair, asset.Spot, startTime, end, kline.Interval(time.Hour*7)) if err == nil { - t.Fatal("unexpected result") + t.Error("unexpected result") } } @@ -2379,6 +2381,11 @@ func TestBinance_FormatExchangeKlineInterval(t *testing.T) { kline.OneDay, "1d", }, + { + "OneWeek", + kline.OneWeek, + "1w", + }, { "OneMonth", kline.OneMonth, diff --git a/exchanges/binance/binance_wrapper.go b/exchanges/binance/binance_wrapper.go index f811c1b9..ef29795f 100644 --- a/exchanges/binance/binance_wrapper.go +++ b/exchanges/binance/binance_wrapper.go @@ -1404,14 +1404,19 @@ func (b *Binance) ValidateCredentials(assetType asset.Item) error { } // FormatExchangeKlineInterval returns Interval to exchange formatted string -func (b *Binance) FormatExchangeKlineInterval(in kline.Interval) string { - if in == kline.OneDay { +func (b *Binance) FormatExchangeKlineInterval(interval kline.Interval) string { + switch interval { + case kline.OneDay: return "1d" - } - if in == kline.OneMonth { + case kline.ThreeDay: + return "3d" + case kline.OneWeek: + return "1w" + case kline.OneMonth: return "1M" + default: + return interval.Short() } - return in.Short() } // GetHistoricCandles returns candles between a time period for a set time interval @@ -1419,7 +1424,7 @@ func (b *Binance) GetHistoricCandles(pair currency.Pair, a asset.Item, start, en if err := b.ValidateKline(pair, a, interval); err != nil { return kline.Item{}, err } - if kline.TotalCandlesPerInterval(start, end, interval) > b.Features.Enabled.Kline.ResultLimit { + if kline.TotalCandlesPerInterval(start, end, interval) > float64(b.Features.Enabled.Kline.ResultLimit) { return kline.Item{}, errors.New(kline.ErrRequestExceedsExchangeLimits) } req := KlinesRequestParams{ @@ -1466,14 +1471,13 @@ func (b *Binance) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, s Asset: a, Interval: interval, } - - dates := kline.CalcDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) - for x := range dates { + dates := kline.CalculateCandleDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) + for x := range dates.Ranges { req := KlinesRequestParams{ Interval: b.FormatExchangeKlineInterval(interval), Symbol: pair, - StartTime: dates[x].Start, - EndTime: dates[x].End, + StartTime: dates.Ranges[x].Start.Time, + EndTime: dates.Ranges[x].End.Time, Limit: int(b.Features.Enabled.Kline.ResultLimit), } @@ -1483,6 +1487,11 @@ func (b *Binance) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, s } for i := range candles { + for j := range ret.Candles { + if ret.Candles[j].Time.Equal(candles[i].OpenTime) { + continue + } + } ret.Candles = append(ret.Candles, kline.Candle{ Time: candles[i].OpenTime, Open: candles[i].Open, @@ -1494,6 +1503,13 @@ func (b *Binance) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, s } } + err := dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", b.Name, err) + } + + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/bitfinex/bitfinex_wrapper.go b/exchanges/bitfinex/bitfinex_wrapper.go index 7dc3ea55..ab540aa4 100644 --- a/exchanges/bitfinex/bitfinex_wrapper.go +++ b/exchanges/bitfinex/bitfinex_wrapper.go @@ -978,7 +978,7 @@ func (b *Bitfinex) GetHistoricCandles(pair currency.Pair, a asset.Item, start, e return kline.Item{}, err } - if kline.TotalCandlesPerInterval(start, end, interval) > b.Features.Enabled.Kline.ResultLimit { + if kline.TotalCandlesPerInterval(start, end, interval) > float64(b.Features.Enabled.Kline.ResultLimit) { return kline.Item{}, errors.New(kline.ErrRequestExceedsExchangeLimits) } @@ -1028,15 +1028,16 @@ func (b *Bitfinex) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, Interval: interval, } - dates := kline.CalcDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) + dates := kline.CalculateCandleDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) cf, err := b.fixCasing(pair, a) if err != nil { return kline.Item{}, err } - for x := range dates { - candles, err := b.GetCandles(cf, b.FormatExchangeKlineInterval(interval), - dates[x].Start.Unix()*1000, dates[x].End.Unix()*1000, + for x := range dates.Ranges { + var candles []Candle + candles, err = b.GetCandles(cf, b.FormatExchangeKlineInterval(interval), + dates.Ranges[x].Start.Ticks*1000, dates.Ranges[x].End.Ticks*1000, b.Features.Enabled.Kline.ResultLimit, true) if err != nil { return kline.Item{}, err @@ -1053,7 +1054,12 @@ func (b *Bitfinex) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, }) } } - + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", b.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/bithumb/bithumb.go b/exchanges/bithumb/bithumb.go index 876297ba..a977082f 100644 --- a/exchanges/bithumb/bithumb.go +++ b/exchanges/bithumb/bithumb.go @@ -238,7 +238,7 @@ func (b *Bithumb) GetWalletAddress(currency string) (WalletAddressRes, error) { if response.Data.WalletAddress == "" { return response, - fmt.Errorf("deposit address needs to be created via the Bithumb website before retreival for currency %s", + fmt.Errorf("deposit address needs to be created via the Bithumb website before retrieval for currency %s", currency) } diff --git a/exchanges/bitstamp/bitstamp_wrapper.go b/exchanges/bitstamp/bitstamp_wrapper.go index 5e362a79..54f3fd91 100644 --- a/exchanges/bitstamp/bitstamp_wrapper.go +++ b/exchanges/bitstamp/bitstamp_wrapper.go @@ -849,17 +849,18 @@ func (b *Bitstamp) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, Interval: interval, } - dates := kline.CalcDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) + dates := kline.CalculateCandleDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) formattedPair, err := b.FormatExchangeCurrency(pair, a) if err != nil { return kline.Item{}, err } - for x := range dates { - candles, err := b.OHLC( + for x := range dates.Ranges { + var candles OHLCResponse + candles, err = b.OHLC( formattedPair.Lower().String(), - dates[x].Start, - dates[x].End, + dates.Ranges[x].Start.Time, + dates.Ranges[x].End.Time, b.FormatExchangeKlineInterval(interval), strconv.FormatInt(int64(b.Features.Enabled.Kline.ResultLimit), 10), ) @@ -882,7 +883,12 @@ func (b *Bitstamp) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, }) } } - + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", b.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/btcmarkets/btcmarkets_wrapper.go b/exchanges/btcmarkets/btcmarkets_wrapper.go index cda271fc..c598ff5a 100644 --- a/exchanges/btcmarkets/btcmarkets_wrapper.go +++ b/exchanges/btcmarkets/btcmarkets_wrapper.go @@ -897,7 +897,7 @@ func (b *BTCMarkets) GetHistoricCandles(pair currency.Pair, a asset.Item, start, return kline.Item{}, err } - if kline.TotalCandlesPerInterval(start, end, interval) > b.Features.Enabled.Kline.ResultLimit { + if kline.TotalCandlesPerInterval(start, end, interval) > float64(b.Features.Enabled.Kline.ResultLimit) { return kline.Item{}, errors.New(kline.ErrRequestExceedsExchangeLimits) } @@ -977,11 +977,12 @@ func (b *BTCMarkets) GetHistoricCandlesExtended(p currency.Pair, a asset.Item, s Interval: interval, } - dates := kline.CalcDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) - for x := range dates { - candles, err := b.GetMarketCandles(fPair.String(), + dates := kline.CalculateCandleDateRanges(start, end, interval, b.Features.Enabled.Kline.ResultLimit) + for x := range dates.Ranges { + var candles CandleResponse + candles, err = b.GetMarketCandles(fPair.String(), b.FormatExchangeKlineInterval(interval), - dates[x].Start, dates[x].End, -1, -1, -1) + dates.Ranges[x].Start.Time, dates.Ranges[x].End.Time, -1, -1, -1) if err != nil { return kline.Item{}, err } @@ -1018,6 +1019,12 @@ func (b *BTCMarkets) GetHistoricCandlesExtended(p currency.Pair, a asset.Item, s } } + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", b.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/btse/btse_wrapper.go b/exchanges/btse/btse_wrapper.go index 7bd6e4ce..47215adb 100644 --- a/exchanges/btse/btse_wrapper.go +++ b/exchanges/btse/btse_wrapper.go @@ -964,7 +964,7 @@ func (b *BTSE) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, star return kline.Item{}, err } - if kline.TotalCandlesPerInterval(start, end, interval) > b.Features.Enabled.Kline.ResultLimit { + if kline.TotalCandlesPerInterval(start, end, interval) > float64(b.Features.Enabled.Kline.ResultLimit) { return kline.Item{}, errors.New(kline.ErrRequestExceedsExchangeLimits) } diff --git a/exchanges/coinbasepro/coinbasepro_wrapper.go b/exchanges/coinbasepro/coinbasepro_wrapper.go index f4b2aaa1..26cbb10d 100644 --- a/exchanges/coinbasepro/coinbasepro_wrapper.go +++ b/exchanges/coinbasepro/coinbasepro_wrapper.go @@ -849,7 +849,7 @@ func (c *CoinbasePro) GetHistoricCandles(p currency.Pair, a asset.Item, start, e return kline.Item{}, err } - if kline.TotalCandlesPerInterval(start, end, interval) > c.Features.Enabled.Kline.ResultLimit { + if kline.TotalCandlesPerInterval(start, end, interval) > float64(c.Features.Enabled.Kline.ResultLimit) { return kline.Item{}, errors.New(kline.ErrRequestExceedsExchangeLimits) } @@ -910,17 +910,18 @@ func (c *CoinbasePro) GetHistoricCandlesExtended(p currency.Pair, a asset.Item, if err != nil { return kline.Item{}, err } - dates := kline.CalcDateRanges(start, end, interval, c.Features.Enabled.Kline.ResultLimit) + dates := kline.CalculateCandleDateRanges(start, end, interval, c.Features.Enabled.Kline.ResultLimit) formattedPair, err := c.FormatExchangeCurrency(p, a) if err != nil { return kline.Item{}, err } - for x := range dates { - history, err := c.GetHistoricRates(formattedPair.String(), - dates[x].Start.Format(time.RFC3339), - dates[x].End.Format(time.RFC3339), + for x := range dates.Ranges { + var history []History + history, err = c.GetHistoricRates(formattedPair.String(), + dates.Ranges[x].Start.Time.Format(time.RFC3339), + dates.Ranges[x].End.Time.Format(time.RFC3339), gran) if err != nil { return kline.Item{}, err @@ -937,7 +938,12 @@ func (c *CoinbasePro) GetHistoricCandlesExtended(p currency.Pair, a asset.Item, }) } } - + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", c.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/ftx/ftx_wrapper.go b/exchanges/ftx/ftx_wrapper.go index 3c520753..520d78ae 100644 --- a/exchanges/ftx/ftx_wrapper.go +++ b/exchanges/ftx/ftx_wrapper.go @@ -1062,18 +1062,19 @@ func (f *FTX) GetHistoricCandlesExtended(p currency.Pair, a asset.Item, start, e Interval: interval, } - dates := kline.CalcDateRanges(start, end, interval, f.Features.Enabled.Kline.ResultLimit) + dates := kline.CalculateCandleDateRanges(start, end, interval, f.Features.Enabled.Kline.ResultLimit) formattedPair, err := f.FormatExchangeCurrency(p, a) if err != nil { return kline.Item{}, err } - for x := range dates { - ohlcData, err := f.GetHistoricalData(formattedPair.String(), + for x := range dates.Ranges { + var ohlcData []OHLCVData + ohlcData, err = f.GetHistoricalData(formattedPair.String(), f.FormatExchangeKlineInterval(interval), strconv.FormatInt(int64(f.Features.Enabled.Kline.ResultLimit), 10), - dates[x].Start, dates[x].End) + dates.Ranges[x].Start.Time, dates.Ranges[x].End.Time) if err != nil { return kline.Item{}, err } @@ -1089,5 +1090,12 @@ func (f *FTX) GetHistoricCandlesExtended(p currency.Pair, a asset.Item, start, e }) } } + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", f.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) + ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/hitbtc/hitbtc_wrapper.go b/exchanges/hitbtc/hitbtc_wrapper.go index 3830cf58..b530cc27 100644 --- a/exchanges/hitbtc/hitbtc_wrapper.go +++ b/exchanges/hitbtc/hitbtc_wrapper.go @@ -852,17 +852,18 @@ func (h *HitBTC) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, st Interval: interval, } - dates := kline.CalcDateRanges(start, end, interval, h.Features.Enabled.Kline.ResultLimit) + dates := kline.CalculateCandleDateRanges(start, end, interval, h.Features.Enabled.Kline.ResultLimit) formattedPair, err := h.FormatExchangeCurrency(pair, a) if err != nil { return kline.Item{}, err } - for y := range dates { - data, err := h.GetCandles(formattedPair.String(), + for y := range dates.Ranges { + var data []ChartData + data, err = h.GetCandles(formattedPair.String(), strconv.FormatInt(int64(h.Features.Enabled.Kline.ResultLimit), 10), h.FormatExchangeKlineInterval(interval), - dates[y].Start, dates[y].End) + dates.Ranges[y].Start.Time, dates.Ranges[y].End.Time) if err != nil { return kline.Item{}, err } @@ -878,7 +879,12 @@ func (h *HitBTC) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, st }) } } - + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", h.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/kline/kline.go b/exchanges/kline/kline.go index 861dfb2f..8a93e942 100644 --- a/exchanges/kline/kline.go +++ b/exchanges/kline/kline.go @@ -5,8 +5,10 @@ import ( "fmt" "sort" "strings" + "sync" "time" + "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/currency" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -159,6 +161,76 @@ func (i Interval) Short() string { return s } +// FillMissingDataWithEmptyEntries amends a kline item to have candle entries +// for every interval between its start and end dates derived from ranges +func (k *Item) FillMissingDataWithEmptyEntries(i *IntervalRangeHolder) { + var anyChanges bool + for x := range i.Ranges { + for y := range i.Ranges[x].Intervals { + if !i.Ranges[x].Intervals[y].HasData { + for z := range k.Candles { + if i.Ranges[x].Intervals[y].Start.Equal(k.Candles[z].Time) { + break + } + } + anyChanges = true + k.Candles = append(k.Candles, Candle{ + Time: i.Ranges[x].Intervals[y].Start.Time, + }) + } + } + } + if anyChanges { + k.SortCandlesByTimestamp(false) + } +} + +// RemoveDuplicates removes any duplicate candles +func (k *Item) RemoveDuplicates() { + var newCandles []Candle + for x := range k.Candles { + if x == 0 { + newCandles = append(newCandles, k.Candles[x]) + continue + } + if !k.Candles[x].Time.Equal(k.Candles[x-1].Time) { + // don't add duplicate + newCandles = append(newCandles, k.Candles[x]) + } + } + + k.Candles = newCandles +} + +// RemoveOutsideRange removes any candles outside the start and end date +func (k *Item) RemoveOutsideRange(start, end time.Time) { + var newCandles []Candle + for i := range k.Candles { + if k.Candles[i].Time.Equal(start) || + (k.Candles[i].Time.After(start) && k.Candles[i].Time.Before(end)) { + newCandles = append(newCandles, k.Candles[i]) + } + } + k.Candles = newCandles +} + +// SortCandlesByTimestamp sorts candles by timestamp +func (k *Item) SortCandlesByTimestamp(desc bool) { + sort.Slice(k.Candles, func(i, j int) bool { + if desc { + return k.Candles[i].Time.After(k.Candles[j].Time) + } + return k.Candles[i].Time.Before(k.Candles[j].Time) + }) +} + +// FormatDates converts all date to UTC time +func (k *Item) FormatDates() { + for x := range k.Candles { + k.Candles[x].Time = k.Candles[x].Time.UTC() + } +} + // durationToWord returns english version of interval func durationToWord(in Interval) string { switch in { @@ -208,101 +280,179 @@ func durationToWord(in Interval) string { } // TotalCandlesPerInterval turns total candles per period for interval -func TotalCandlesPerInterval(start, end time.Time, interval Interval) (out uint32) { +func TotalCandlesPerInterval(start, end time.Time, interval Interval) (out float64) { switch interval { case FifteenSecond: - out = uint32(end.Sub(start).Seconds() / 15) + return end.Sub(start).Seconds() / 15 case OneMin: - out = uint32(end.Sub(start).Minutes()) + return end.Sub(start).Minutes() case ThreeMin: - out = uint32(end.Sub(start).Minutes() / 3) + return end.Sub(start).Minutes() / 3 case FiveMin: - out = uint32(end.Sub(start).Minutes() / 5) + return end.Sub(start).Minutes() / 5 case TenMin: - out = uint32(end.Sub(start).Minutes() / 10) + return end.Sub(start).Minutes() / 10 case FifteenMin: - out = uint32(end.Sub(start).Minutes() / 15) + return end.Sub(start).Minutes() / 15 case ThirtyMin: - out = uint32(end.Sub(start).Minutes() / 30) + return end.Sub(start).Minutes() / 30 case OneHour: - out = uint32(end.Sub(start).Hours()) + return end.Sub(start).Hours() case TwoHour: - out = uint32(end.Sub(start).Hours() / 2) + return end.Sub(start).Hours() / 2 case FourHour: - out = uint32(end.Sub(start).Hours() / 4) + return end.Sub(start).Hours() / 4 case SixHour: - out = uint32(end.Sub(start).Hours() / 6) + return end.Sub(start).Hours() / 6 case EightHour: - out = uint32(end.Sub(start).Hours() / 8) + return end.Sub(start).Hours() / 8 case TwelveHour: - out = uint32(end.Sub(start).Hours() / 12) + return end.Sub(start).Hours() / 12 case OneDay: - out = uint32(end.Sub(start).Hours() / 24) + return end.Sub(start).Hours() / 24 case ThreeDay: - out = uint32(end.Sub(start).Hours() / 72) + return end.Sub(start).Hours() / 72 case FifteenDay: - out = uint32(end.Sub(start).Hours() / (24 * 15)) + return end.Sub(start).Hours() / (24 * 15) case OneWeek: - out = uint32(end.Sub(start).Hours()) / (24 * 7) + return end.Sub(start).Hours() / (24 * 7) case TwoWeek: - out = uint32(end.Sub(start).Hours() / (24 * 14)) + return end.Sub(start).Hours() / (24 * 14) case OneMonth: - out = uint32(end.Sub(start).Hours() / (24 * 30)) + return end.Sub(start).Hours() / (24 * 30) case OneYear: - out = uint32(end.Sub(start).Hours() / 8760) + return end.Sub(start).Hours() / 8760 } - return out + return -1 } -// CalcDateRanges returns slice of start/end times based on start & end date -func CalcDateRanges(start, end time.Time, interval Interval, limit uint32) (out []DateRange) { - total := TotalCandlesPerInterval(start, end, interval) - if total < limit { - return []DateRange{{ - Start: start, - End: end, - }, - } +// IntervalsPerYear helps determine the number of intervals in a year +// used in CAGR calculation to know the amount of time of an interval in a year +func (i *Interval) IntervalsPerYear() float64 { + return float64(OneYear.Duration().Nanoseconds()) / float64(i.Duration().Nanoseconds()) +} + +// CalculateCandleDateRanges will calculate the expected candle data in intervals in a date range +// If an API is limited in the amount of candles it can make in a request, it will automatically separate +// ranges into the limit +func CalculateCandleDateRanges(start, end time.Time, interval Interval, limit uint32) IntervalRangeHolder { + start = start.Round(interval.Duration()) + end = end.Round(interval.Duration()) + resp := IntervalRangeHolder{ + Start: CreateIntervalTime(start), + End: CreateIntervalTime(end), } - var allDateIntervals []time.Time - var y uint32 - var lastNum int - for d := start; !d.After(end); d = d.Add(interval.Duration()) { - allDateIntervals = append(allDateIntervals, d) - } - for x := range allDateIntervals { - if y == limit { - out = append(out, DateRange{ - allDateIntervals[x-int(limit)], - allDateIntervals[x], - }) - y = 0 - lastNum = x - } - y++ - } - if allDateIntervals != nil && lastNum+1 < len(allDateIntervals) { - out = append(out, DateRange{ - Start: allDateIntervals[lastNum+1], - End: allDateIntervals[len(allDateIntervals)-1], + var intervalsInWholePeriod []IntervalData + for i := start; !i.After(end) && !i.Equal(end); i = i.Add(interval.Duration()) { + intervalsInWholePeriod = append(intervalsInWholePeriod, IntervalData{ + Start: CreateIntervalTime(i.Round(interval.Duration())), + End: CreateIntervalTime(i.Round(interval.Duration()).Add(interval.Duration())), }) } - return out + if len(intervalsInWholePeriod) < int(limit) || limit == 0 { + resp.Ranges = []IntervalRange{{ + Start: CreateIntervalTime(start), + End: CreateIntervalTime(end), + Intervals: intervalsInWholePeriod, + }} + return resp + } + + var intervals []IntervalData + splitIntervalsByLimit := make([][]IntervalData, 0, len(intervalsInWholePeriod)/int(limit)+1) + for len(intervalsInWholePeriod) >= int(limit) { + intervals, intervalsInWholePeriod = intervalsInWholePeriod[:limit], intervalsInWholePeriod[limit:] + splitIntervalsByLimit = append(splitIntervalsByLimit, intervals) + } + if len(intervalsInWholePeriod) > 0 { + splitIntervalsByLimit = append(splitIntervalsByLimit, intervalsInWholePeriod) + } + + for x := range splitIntervalsByLimit { + resp.Ranges = append(resp.Ranges, IntervalRange{ + Start: splitIntervalsByLimit[x][0].Start, + End: splitIntervalsByLimit[x][len(splitIntervalsByLimit[x])-1].End, + Intervals: splitIntervalsByLimit[x], + }) + } + + return resp } -// SortCandlesByTimestamp sorts candles by timestamp -func (k *Item) SortCandlesByTimestamp(desc bool) { - sort.Slice(k.Candles, func(i, j int) bool { - if desc { - return k.Candles[i].Time.After(k.Candles[j].Time) +// HasDataAtDate determines whether a there is any data at a set +// date inside the existing limits +func (h *IntervalRangeHolder) HasDataAtDate(t time.Time) bool { + tu := t.Unix() + if tu < h.Start.Ticks || tu > h.End.Ticks { + return false + } + for i := range h.Ranges { + if tu >= h.Ranges[i].Start.Ticks && tu <= h.Ranges[i].End.Ticks { + for j := range h.Ranges[i].Intervals { + if tu >= h.Ranges[i].Intervals[j].Start.Ticks && tu < h.Ranges[i].Intervals[j].End.Ticks { + return h.Ranges[i].Intervals[j].HasData + } + if j == len(h.Ranges[i].Intervals)-1 { + if tu == h.Ranges[i].Start.Ticks { + return h.Ranges[i].Intervals[j].HasData + } + } + } } - return k.Candles[i].Time.Before(k.Candles[j].Time) - }) + } + + return false } -// FormatDates converts all date to UTC time -func (k *Item) FormatDates() { - for x := range k.Candles { - k.Candles[x].Time = k.Candles[x].Time.UTC() +// VerifyResultsHaveData will calculate whether there is data in each candle +// allowing any missing data from an API request to be highlighted +func (h *IntervalRangeHolder) VerifyResultsHaveData(c []Candle) error { + var wg sync.WaitGroup + wg.Add(len(h.Ranges)) + for x := range h.Ranges { + go func(iVal int) { + for y := range h.Ranges[iVal].Intervals { + for z := range c { + cu := c[z].Time.Unix() + if cu >= h.Ranges[iVal].Intervals[y].Start.Ticks && cu < h.Ranges[iVal].Intervals[y].End.Ticks { + h.Ranges[iVal].Intervals[y].HasData = true + break + } + } + } + wg.Done() + }(x) + } + wg.Wait() + + var errs common.Errors + for x := range h.Ranges { + for y := range h.Ranges[x].Intervals { + if !h.Ranges[x].Intervals[y].HasData { + errs = append(errs, fmt.Errorf("between %v (%v) & %v (%v)", + h.Ranges[x].Intervals[y].Start.Time, + h.Ranges[x].Intervals[y].Start.Ticks, + h.Ranges[x].Intervals[y].End.Time, + h.Ranges[x].Intervals[y].End.Ticks)) + } + } + } + if len(errs) > 0 { + return fmt.Errorf("%w - %v", ErrMissingCandleData, errs) + } + + return nil +} + +// Set is a simple helper function to set the time twice +func CreateIntervalTime(tt time.Time) IntervalTime { + return IntervalTime{ + Time: tt, + Ticks: tt.Unix(), } } + +// Equal allows for easier unix comparison +func (i *IntervalTime) Equal(tt time.Time) bool { + return tt.Unix() == i.Ticks +} diff --git a/exchanges/kline/kline_test.go b/exchanges/kline/kline_test.go index 80bd6087..52c5b5ba 100644 --- a/exchanges/kline/kline_test.go +++ b/exchanges/kline/kline_test.go @@ -283,7 +283,7 @@ func TestTotalCandlesPerInterval(t *testing.T) { testCases := []struct { name string interval Interval - expected uint32 + expected float64 }{ { "FifteenSecond", @@ -358,27 +358,27 @@ func TestTotalCandlesPerInterval(t *testing.T) { { "ThreeDay", ThreeDay, - 121, + 121.66666666666667, }, { "FifteenDay", FifteenDay, - 24, + 24.333333333333332, }, { "OneWeek", OneWeek, - 52, + 52.142857142857146, }, { "TwoWeek", TwoWeek, - 26, + 26.071428571428573, }, { "OneMonth", OneMonth, - 12, + 12.166666666666666, }, { "OneYear", @@ -397,19 +397,37 @@ func TestTotalCandlesPerInterval(t *testing.T) { } } -func TestCalcDateRanges(t *testing.T) { +func TestCalculateCandleDateRanges(t *testing.T) { start := time.Unix(1546300800, 0) end := time.Unix(1577836799, 0) - v := CalcDateRanges(start, end, OneMin, 300) + v := CalculateCandleDateRanges(start, end, OneMin, 300) - if v[0].Start.Unix() != time.Unix(1546300800, 0).Unix() { - t.Fatalf("unexpected result received %v", v[0].Start.Unix()) + if v.Ranges[0].Start.Ticks != time.Unix(1546300800, 0).Unix() { + t.Errorf("expected %v received %v", 1546300800, v.Ranges[0].Start.Ticks) } - v = CalcDateRanges(time.Now(), time.Now().AddDate(0, 0, 1), OneDay, 100) - if len(v) != 1 { - t.Fatal("expected CalcDateRanges() with a Item count lower than limit to return 1 result") + v = CalculateCandleDateRanges(time.Now(), time.Now().AddDate(0, 0, 1), OneDay, 100) + if len(v.Ranges) != 1 { + t.Fatalf("expected %v received %v", 1, len(v.Ranges)) + } + if len(v.Ranges[0].Intervals) != 1 { + t.Errorf("expected %v received %v", 1, len(v.Ranges[0].Intervals)) + } + start = time.Now() + end = time.Now().AddDate(0, 0, 10) + v = CalculateCandleDateRanges(start, end, OneDay, 5) + if len(v.Ranges) != 2 { + t.Errorf("expected %v received %v", 2, len(v.Ranges)) + } + if len(v.Ranges[0].Intervals) != 5 { + t.Errorf("expected %v received %v", 5, len(v.Ranges[0].Intervals)) + } + if len(v.Ranges[1].Intervals) != 5 { + t.Errorf("expected %v received %v", 5, len(v.Ranges[1].Intervals)) + } + if !v.Ranges[1].Intervals[4].End.Equal(end.Round(OneDay.Duration())) { + t.Errorf("expected %v received %v", end.Round(OneDay.Duration()), v.Ranges[1].Intervals[4].End) } } @@ -690,3 +708,107 @@ func TestLoadCSV(t *testing.T) { t.Fatalf("unexpected value received: %v", v[364].Open) } } + +func TestVerifyResultsHaveData(t *testing.T) { + tt2 := time.Now().Round(OneDay.Duration()) + tt1 := time.Now().Add(-time.Hour * 24).Round(OneDay.Duration()) + dateRanges := CalculateCandleDateRanges(tt1, tt2, OneDay, 0) + if dateRanges.HasDataAtDate(tt1) { + t.Error("unexpected true value") + } + + err := dateRanges.VerifyResultsHaveData(nil) + if err == nil { + t.Error("expected error") + } + if err != nil && !strings.Contains(err.Error(), ErrMissingCandleData.Error()) { + t.Errorf("expected %v", ErrMissingCandleData) + } + + err = dateRanges.VerifyResultsHaveData([]Candle{ + { + Time: tt1, + }, + }) + if err != nil { + t.Error(err) + } +} + +func TestHasDataAtDate(t *testing.T) { + tt2 := time.Now().Round(OneDay.Duration()) + tt1 := time.Now().Add(-time.Hour * 24 * 30).Round(OneDay.Duration()) + dateRanges := CalculateCandleDateRanges(tt1, tt2, OneDay, 0) + if dateRanges.HasDataAtDate(tt1) { + t.Error("unexpected true value") + } + + _ = dateRanges.VerifyResultsHaveData([]Candle{ + { + Time: tt1, + }, + { + Time: tt2, + }, + }) + + if !dateRanges.HasDataAtDate(tt1.Round(OneDay.Duration())) { + t.Error("unexpected false value") + } + + if dateRanges.HasDataAtDate(tt2.Add(time.Hour * 24 * 26)) { + t.Error("should not have data") + } +} + +func TestIntervalsPerYear(t *testing.T) { + i := OneYear + if i.IntervalsPerYear() != 1.0 { + t.Error("expected 1") + } + i = OneDay + if i.IntervalsPerYear() != 365 { + t.Error("expected 365") + } + i = OneHour + if i.IntervalsPerYear() != 8760 { + t.Error("expected 8670") + } + i = TwoHour + if i.IntervalsPerYear() != 4380 { + t.Error("expected 4380") + } + i = TwoHour + FifteenSecond + if i.IntervalsPerYear() != 4370.893970893971 { + t.Error("expected 4370...") + } +} + +// The purpose of this benchmark is to highlight that requesting +// '.Unix()` frequently is a slow process +func BenchmarkJustifyIntervalTimeStoringUnixValues1(b *testing.B) { + tt1 := time.Now() + tt2 := time.Now().Add(-time.Hour) + tt3 := time.Now().Add(time.Hour) + for i := 0; i < b.N; i++ { + if tt1.Unix() == tt2.Unix() || // nolint:staticcheck // it is a benchmark to demonstrate inefficiency in calling + (tt1.Unix() > tt2.Unix() && tt1.Unix() < tt3.Unix()) { + + } + } +} + +// The purpose of this benchmark is to highlight that storing the unix value +// at time of creation is dramatically faster than frequently requesting `.Unix()` +// at runtime at scale. When dealing with the backtester and comparing +// tens of thousands of candle times +func BenchmarkJustifyIntervalTimeStoringUnixValues2(b *testing.B) { + tt1 := time.Now().Unix() + tt2 := time.Now().Add(-time.Hour).Unix() + tt3 := time.Now().Add(time.Hour).Unix() + for i := 0; i < b.N; i++ { + if tt1 >= tt2 && tt1 <= tt3 { // nolint:staticcheck // it is a benchmark to demonstrate inefficiency in calling + + } + } +} diff --git a/exchanges/kline/kline_types.go b/exchanges/kline/kline_types.go index ae74071c..95230ead 100644 --- a/exchanges/kline/kline_types.go +++ b/exchanges/kline/kline_types.go @@ -1,6 +1,7 @@ package kline import ( + "errors" "time" "github.com/thrasher-corp/gocryptotrader/currency" @@ -37,6 +38,34 @@ const ( ErrRequestExceedsExchangeLimits = "requested data would exceed exchange limits please lower range or use GetHistoricCandlesEx" ) +var ( + ErrMissingCandleData = errors.New("missing candle data") + // SupportedIntervals is a list of all supported intervals + SupportedIntervals = []Interval{ + FifteenSecond, + OneMin, + ThreeMin, + FiveMin, + TenMin, + FifteenMin, + ThirtyMin, + OneHour, + TwoHour, + FourHour, + SixHour, + EightHour, + TwelveHour, + OneDay, + ThreeDay, + SevenDay, + FifteenDay, + OneWeek, + TwoWeek, + OneMonth, + OneYear, + } +) + // Item holds all the relevant information for internal kline elements type Item struct { Exchange string @@ -56,7 +85,7 @@ type Candle struct { Volume float64 } -// By Date allows for sorting candle entries by date +// ByDate allows for sorting candle entries by date type ByDate []Candle func (b ByDate) Len() int { @@ -104,8 +133,33 @@ func (k *ErrorKline) Unwrap() error { return k.Err } -// DateRange holds a start and end date for kline usage -type DateRange struct { - Start time.Time - End time.Time +// IntervalRangeHolder holds the entire range of intervals +// and the start end dates of everything +type IntervalRangeHolder struct { + Start IntervalTime + End IntervalTime + Ranges []IntervalRange +} + +// IntervalRange is a subset of candles based on exchange API request limits +type IntervalRange struct { + Start IntervalTime + End IntervalTime + Intervals []IntervalData +} + +// IntervalData is used to monitor which candles contain data +// to determine if any data is missing +type IntervalData struct { + Start IntervalTime + End IntervalTime + HasData bool +} + +// IntervalTime benchmarks demonstrate, see +// BenchmarkJustifyIntervalTimeStoringUnixValues1 && +// BenchmarkJustifyIntervalTimeStoringUnixValues2 +type IntervalTime struct { + Time time.Time + Ticks int64 } diff --git a/exchanges/lbank/lbank_wrapper.go b/exchanges/lbank/lbank_wrapper.go index 52f1d7d5..1eb8ad96 100644 --- a/exchanges/lbank/lbank_wrapper.go +++ b/exchanges/lbank/lbank_wrapper.go @@ -938,22 +938,23 @@ func (l *Lbank) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, sta Interval: interval, } - dates := kline.CalcDateRanges(start, end, interval, l.Features.Enabled.Kline.ResultLimit) + dates := kline.CalculateCandleDateRanges(start, end, interval, l.Features.Enabled.Kline.ResultLimit) formattedPair, err := l.FormatExchangeCurrency(pair, a) if err != nil { return kline.Item{}, err } - for x := range dates { - data, err := l.GetKlines(formattedPair.String(), + for x := range dates.Ranges { + var data []KlineResponse + data, err = l.GetKlines(formattedPair.String(), strconv.FormatInt(int64(l.Features.Enabled.Kline.ResultLimit), 10), l.FormatExchangeKlineInterval(interval), - strconv.FormatInt(dates[x].Start.UTC().Unix(), 10)) + strconv.FormatInt(dates.Ranges[x].Start.Ticks, 10)) if err != nil { return kline.Item{}, err } for i := range data { - if time.Unix(data[i].TimeStamp, 0).UTC().Before(dates[x].Start.UTC()) || time.Unix(data[i].TimeStamp, 0).UTC().After(dates[x].End.UTC()) { + if data[i].TimeStamp < dates.Ranges[x].Start.Ticks || data[i].TimeStamp > dates.Ranges[x].End.Ticks { continue } ret.Candles = append(ret.Candles, kline.Candle{ @@ -967,6 +968,12 @@ func (l *Lbank) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, sta } } + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", l.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) ret.SortCandlesByTimestamp(false) return ret, nil } diff --git a/exchanges/okcoin/okcoin_test.go b/exchanges/okcoin/okcoin_test.go index f7d204ef..c9831eb0 100644 --- a/exchanges/okcoin/okcoin_test.go +++ b/exchanges/okcoin/okcoin_test.go @@ -1107,7 +1107,7 @@ func TestGetHistoricCandlesExtended(t *testing.T) { t.Fatal(err) } startTime := time.Unix(1588636800, 0) - _, err = o.GetHistoricCandlesExtended(currencyPair, asset.Spot, startTime, time.Now(), kline.OneMin) + _, err = o.GetHistoricCandlesExtended(currencyPair, asset.Spot, startTime, time.Now(), kline.OneWeek) if err != nil { t.Fatal(err) } diff --git a/exchanges/okcoin/okcoin_wrapper.go b/exchanges/okcoin/okcoin_wrapper.go index ca8d5602..282be9b2 100644 --- a/exchanges/okcoin/okcoin_wrapper.go +++ b/exchanges/okcoin/okcoin_wrapper.go @@ -1,14 +1,11 @@ package okcoin import ( - "errors" "fmt" "sort" "sync" - "time" "github.com/thrasher-corp/gocryptotrader/common" - "github.com/thrasher-corp/gocryptotrader/common/convert" "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" @@ -322,157 +319,6 @@ func (o *OKCoin) FetchTicker(p currency.Pair, assetType asset.Item) (tickerData return } -// GetHistoricCandles returns candles between a time period for a set time interval -func (o *OKCoin) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) { - if err := o.ValidateKline(pair, a, interval); err != nil { - return kline.Item{}, err - } - - formattedPair, err := o.FormatExchangeCurrency(pair, a) - if err != nil { - return kline.Item{}, err - } - - req := &okgroup.GetMarketDataRequest{ - Asset: a, - Start: start.UTC().Format(time.RFC3339), - End: end.UTC().Format(time.RFC3339), - Granularity: o.FormatExchangeKlineInterval(interval), - InstrumentID: formattedPair.String(), - } - - candles, err := o.GetMarketData(req) - if err != nil { - return kline.Item{}, err - } - - ret := kline.Item{ - Exchange: o.Name, - Pair: pair, - Asset: a, - Interval: interval, - } - - for x := range candles { - t := candles[x].([]interface{}) - tempCandle := kline.Candle{} - v, ok := t[0].(string) - if !ok { - return kline.Item{}, errors.New("unexpected value received") - } - tempCandle.Time, err = time.Parse(time.RFC3339, v) - if err != nil { - return kline.Item{}, err - } - tempCandle.Open, err = convert.FloatFromString(t[1]) - if err != nil { - return kline.Item{}, err - } - tempCandle.High, err = convert.FloatFromString(t[2]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Low, err = convert.FloatFromString(t[3]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Close, err = convert.FloatFromString(t[4]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Volume, err = convert.FloatFromString(t[5]) - if err != nil { - return kline.Item{}, err - } - ret.Candles = append(ret.Candles, tempCandle) - } - ret.SortCandlesByTimestamp(false) - return ret, nil -} - -// GetHistoricCandlesExtended returns candles between a time period for a set time interval -func (o *OKCoin) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) { - if err := o.ValidateKline(pair, a, interval); err != nil { - return kline.Item{}, err - } - - ret := kline.Item{ - Exchange: o.Name, - Pair: pair, - Asset: a, - Interval: interval, - } - - dates := kline.CalcDateRanges(start, end, interval, o.Features.Enabled.Kline.ResultLimit) - formattedPair, err := o.FormatExchangeCurrency(pair, a) - if err != nil { - return kline.Item{}, err - } - - for x := range dates { - req := &okgroup.GetMarketDataRequest{ - Asset: a, - Start: dates[x].Start.UTC().Format(time.RFC3339), - End: dates[x].End.UTC().Format(time.RFC3339), - Granularity: o.FormatExchangeKlineInterval(interval), - InstrumentID: formattedPair.String(), - } - - candles, err := o.GetMarketData(req) - if err != nil { - return kline.Item{}, err - } - - for i := range candles { - t := candles[i].([]interface{}) - tempCandle := kline.Candle{} - v, ok := t[0].(string) - if !ok { - return kline.Item{}, errors.New("unexpected value received") - } - tempCandle.Time, err = time.Parse(time.RFC3339, v) - if err != nil { - return kline.Item{}, err - } - tempCandle.Open, err = convert.FloatFromString(t[1]) - if err != nil { - return kline.Item{}, err - } - tempCandle.High, err = convert.FloatFromString(t[2]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Low, err = convert.FloatFromString(t[3]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Close, err = convert.FloatFromString(t[4]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Volume, err = convert.FloatFromString(t[5]) - if err != nil { - return kline.Item{}, err - } - ret.Candles = append(ret.Candles, tempCandle) - } - } - - ret.SortCandlesByTimestamp(false) - return ret, nil -} - -// GetWithdrawalsHistory returns previous withdrawals data -func (o *OKCoin) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) { - return nil, common.ErrNotYetImplemented -} - // GetRecentTrades returns the most recent trades for a currency and asset func (o *OKCoin) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) { var err error diff --git a/exchanges/okex/okex_test.go b/exchanges/okex/okex_test.go index be74f1f4..d642c37e 100644 --- a/exchanges/okex/okex_test.go +++ b/exchanges/okex/okex_test.go @@ -662,7 +662,7 @@ func TestGetHistoricCandlesExtended(t *testing.T) { } startTime := time.Unix(1607494054, 0) endTime := time.Unix(1607512054, 0) - _, err = o.GetHistoricCandlesExtended(currencyPair, asset.Spot, startTime, endTime, kline.OneHour) + _, err = o.GetHistoricCandlesExtended(currencyPair, asset.Spot, startTime, endTime, kline.OneWeek) if err != nil { t.Fatal(err) } diff --git a/exchanges/okex/okex_wrapper.go b/exchanges/okex/okex_wrapper.go index 5fdd5e22..71ec57c4 100644 --- a/exchanges/okex/okex_wrapper.go +++ b/exchanges/okex/okex_wrapper.go @@ -6,10 +6,8 @@ import ( "sort" "strings" "sync" - "time" "github.com/thrasher-corp/gocryptotrader/common" - "github.com/thrasher-corp/gocryptotrader/common/convert" "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" @@ -557,157 +555,6 @@ func (o *OKEX) FetchTicker(p currency.Pair, assetType asset.Item) (tickerData *t return } -// GetHistoricCandles returns candles between a time period for a set time interval -func (o *OKEX) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) { - if err := o.ValidateKline(pair, a, interval); err != nil { - return kline.Item{}, err - } - - formattedPair, err := o.FormatExchangeCurrency(pair, a) - if err != nil { - return kline.Item{}, err - } - - req := &okgroup.GetMarketDataRequest{ - Asset: a, - Start: start.UTC().Format(time.RFC3339), - End: end.UTC().Format(time.RFC3339), - Granularity: o.FormatExchangeKlineInterval(interval), - InstrumentID: formattedPair.String(), - } - - candles, err := o.GetMarketData(req) - if err != nil { - return kline.Item{}, err - } - - ret := kline.Item{ - Exchange: o.Name, - Pair: pair, - Asset: a, - Interval: interval, - } - - for x := range candles { - t := candles[x].([]interface{}) - tempCandle := kline.Candle{} - v, ok := t[0].(string) - if !ok { - return kline.Item{}, errors.New("unexpected value received") - } - tempCandle.Time, err = time.Parse(time.RFC3339, v) - if err != nil { - return kline.Item{}, err - } - tempCandle.Open, err = convert.FloatFromString(t[1]) - if err != nil { - return kline.Item{}, err - } - tempCandle.High, err = convert.FloatFromString(t[2]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Low, err = convert.FloatFromString(t[3]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Close, err = convert.FloatFromString(t[4]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Volume, err = convert.FloatFromString(t[5]) - if err != nil { - return kline.Item{}, err - } - ret.Candles = append(ret.Candles, tempCandle) - } - - ret.SortCandlesByTimestamp(false) - return ret, nil -} - -// GetHistoricCandlesExtended returns candles between a time period for a set time interval -func (o *OKEX) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) { - if err := o.ValidateKline(pair, a, interval); err != nil { - return kline.Item{}, err - } - - ret := kline.Item{ - Exchange: o.Name, - Pair: pair, - Asset: a, - Interval: interval, - } - - dates := kline.CalcDateRanges(start, end, interval, o.Features.Enabled.Kline.ResultLimit) - formattedPair, err := o.FormatExchangeCurrency(pair, a) - if err != nil { - return kline.Item{}, err - } - for x := range dates { - req := &okgroup.GetMarketDataRequest{ - Asset: a, - Start: dates[x].Start.UTC().Format(time.RFC3339), - End: dates[x].End.UTC().Format(time.RFC3339), - Granularity: o.FormatExchangeKlineInterval(interval), - InstrumentID: formattedPair.String(), - } - - candles, err := o.GetMarketData(req) - if err != nil { - return kline.Item{}, err - } - - for i := range candles { - t := candles[i].([]interface{}) - tempCandle := kline.Candle{} - v, ok := t[0].(string) - if !ok { - return kline.Item{}, errors.New("unexpected value received") - } - tempCandle.Time, err = time.Parse(time.RFC3339, v) - if err != nil { - return kline.Item{}, err - } - tempCandle.Open, err = convert.FloatFromString(t[1]) - if err != nil { - return kline.Item{}, err - } - tempCandle.High, err = convert.FloatFromString(t[2]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Low, err = convert.FloatFromString(t[3]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Close, err = convert.FloatFromString(t[4]) - if err != nil { - return kline.Item{}, err - } - - tempCandle.Volume, err = convert.FloatFromString(t[5]) - if err != nil { - return kline.Item{}, err - } - ret.Candles = append(ret.Candles, tempCandle) - } - } - - ret.SortCandlesByTimestamp(false) - return ret, nil -} - -// GetWithdrawalsHistory returns previous withdrawals data -func (o *OKEX) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) { - return nil, common.ErrNotYetImplemented -} - // GetRecentTrades returns recent trade data func (o *OKEX) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) { var err error @@ -804,6 +651,6 @@ func (o *OKEX) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.D } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (o *OKEX) CancelBatchOrders(ord []order.Cancel) (order.CancelBatchResponse, error) { +func (o *OKEX) CancelBatchOrders(_ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } diff --git a/exchanges/okgroup/okgroup_wrapper.go b/exchanges/okgroup/okgroup_wrapper.go index ca55109c..30bee556 100644 --- a/exchanges/okgroup/okgroup_wrapper.go +++ b/exchanges/okgroup/okgroup_wrapper.go @@ -8,15 +8,18 @@ import ( "time" "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/common/convert" "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/account" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" + "github.com/thrasher-corp/gocryptotrader/exchanges/kline" "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" "github.com/thrasher-corp/gocryptotrader/exchanges/stream" "github.com/thrasher-corp/gocryptotrader/exchanges/trade" + "github.com/thrasher-corp/gocryptotrader/log" "github.com/thrasher-corp/gocryptotrader/portfolio/withdraw" ) @@ -583,3 +586,157 @@ func (o *OKGroup) ValidateCredentials(assetType asset.Item) error { func (o *OKGroup) GetHistoricTrades(_ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error) { return nil, common.ErrFunctionNotSupported } + +// GetHistoricCandles returns candles between a time period for a set time interval +func (o *OKGroup) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) { + if err := o.ValidateKline(pair, a, interval); err != nil { + return kline.Item{}, err + } + + formattedPair, err := o.FormatExchangeCurrency(pair, a) + if err != nil { + return kline.Item{}, err + } + + req := &GetMarketDataRequest{ + Asset: a, + Start: start.UTC().Format(time.RFC3339), + End: end.UTC().Format(time.RFC3339), + Granularity: o.FormatExchangeKlineInterval(interval), + InstrumentID: formattedPair.String(), + } + + candles, err := o.GetMarketData(req) + if err != nil { + return kline.Item{}, err + } + + ret := kline.Item{ + Exchange: o.Name, + Pair: pair, + Asset: a, + Interval: interval, + } + + for x := range candles { + t := candles[x].([]interface{}) + tempCandle := kline.Candle{} + v, ok := t[0].(string) + if !ok { + return kline.Item{}, errors.New("unexpected value received") + } + tempCandle.Time, err = time.Parse(time.RFC3339, v) + if err != nil { + return kline.Item{}, err + } + tempCandle.Open, err = convert.FloatFromString(t[1]) + if err != nil { + return kline.Item{}, err + } + tempCandle.High, err = convert.FloatFromString(t[2]) + if err != nil { + return kline.Item{}, err + } + + tempCandle.Low, err = convert.FloatFromString(t[3]) + if err != nil { + return kline.Item{}, err + } + + tempCandle.Close, err = convert.FloatFromString(t[4]) + if err != nil { + return kline.Item{}, err + } + + tempCandle.Volume, err = convert.FloatFromString(t[5]) + if err != nil { + return kline.Item{}, err + } + ret.Candles = append(ret.Candles, tempCandle) + } + + ret.SortCandlesByTimestamp(false) + return ret, nil +} + +// GetHistoricCandlesExtended returns candles between a time period for a set time interval +func (o *OKGroup) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) { + if err := o.ValidateKline(pair, a, interval); err != nil { + return kline.Item{}, err + } + + ret := kline.Item{ + Exchange: o.Name, + Pair: pair, + Asset: a, + Interval: interval, + } + + dates := kline.CalculateCandleDateRanges(start, end, interval, o.Features.Enabled.Kline.ResultLimit) + formattedPair, err := o.FormatExchangeCurrency(pair, a) + if err != nil { + return kline.Item{}, err + } + + for x := range dates.Ranges { + req := &GetMarketDataRequest{ + Asset: a, + Start: dates.Ranges[x].Start.Time.UTC().Format(time.RFC3339), + End: dates.Ranges[x].End.Time.UTC().Format(time.RFC3339), + Granularity: o.FormatExchangeKlineInterval(interval), + InstrumentID: formattedPair.String(), + } + + var candles GetMarketDataResponse + candles, err = o.GetMarketData(req) + if err != nil { + return kline.Item{}, err + } + + for i := range candles { + t := candles[i].([]interface{}) + tempCandle := kline.Candle{} + v, ok := t[0].(string) + if !ok { + return kline.Item{}, errors.New("unexpected value received") + } + tempCandle.Time, err = time.Parse(time.RFC3339, v) + if err != nil { + return kline.Item{}, err + } + tempCandle.Open, err = convert.FloatFromString(t[1]) + if err != nil { + return kline.Item{}, err + } + tempCandle.High, err = convert.FloatFromString(t[2]) + if err != nil { + return kline.Item{}, err + } + + tempCandle.Low, err = convert.FloatFromString(t[3]) + if err != nil { + return kline.Item{}, err + } + + tempCandle.Close, err = convert.FloatFromString(t[4]) + if err != nil { + return kline.Item{}, err + } + + tempCandle.Volume, err = convert.FloatFromString(t[5]) + if err != nil { + return kline.Item{}, err + } + ret.Candles = append(ret.Candles, tempCandle) + } + } + + err = dates.VerifyResultsHaveData(ret.Candles) + if err != nil { + log.Warnf(log.ExchangeSys, "%s - %s", o.Name, err) + } + ret.RemoveDuplicates() + ret.RemoveOutsideRange(start, end) + ret.SortCandlesByTimestamp(false) + return ret, nil +} diff --git a/exchanges/orderbook/simulator/simulator_test.go b/exchanges/orderbook/simulator/simulator_test.go index 14e5ec02..b9e3390e 100644 --- a/exchanges/orderbook/simulator/simulator_test.go +++ b/exchanges/orderbook/simulator/simulator_test.go @@ -11,7 +11,6 @@ import ( func TestSimulate(t *testing.T) { b := bitstamp.Bitstamp{} b.SetDefaults() - b.Verbose = false o, err := b.FetchOrderbook(currency.NewPair(currency.BTC, currency.USD), asset.Spot) if err != nil { t.Error(err) diff --git a/exchanges/trade/trade.go b/exchanges/trade/trade.go index 51cd5abd..656b3eaa 100644 --- a/exchanges/trade/trade.go +++ b/exchanges/trade/trade.go @@ -83,7 +83,7 @@ func AddTradesToBuffer(exchangeName string, data ...Data) error { return nil } -// Processor will save trade data to the database in batches +// Run will save trade data to the database in batches func (p *Processor) Run(wg *sync.WaitGroup) { wg.Done() if !atomic.CompareAndSwapInt32(&p.started, 0, 1) { @@ -119,11 +119,7 @@ func SaveTradesToDatabase(trades ...Data) error { if err != nil { return err } - err = tradesql.Insert(sqlTrades...) - if err != nil { - return err - } - return nil + return tradesql.Insert(sqlTrades...) } // GetTradesInRange calls db function to return trades in range diff --git a/exchanges/trade/trade_types.go b/exchanges/trade/trade_types.go index 40010dd1..adf82210 100644 --- a/exchanges/trade/trade_types.go +++ b/exchanges/trade/trade_types.go @@ -10,6 +10,8 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" ) +// DefaultProcessorIntervalTime is the default timer +// to process queued trades and save them to the database const DefaultProcessorIntervalTime = time.Second * 15 var ( diff --git a/gctrpc/rpc.proto b/gctrpc/rpc.proto index b4eec6bd..63c29c87 100644 --- a/gctrpc/rpc.proto +++ b/gctrpc/rpc.proto @@ -1,1363 +1,1363 @@ -syntax = "proto3"; -import "google/api/annotations.proto"; -import "google/protobuf/timestamp.proto"; - -package gctrpc; -option go_package = "github.com/thrasher-corp/gocryptotrader/gctrpc"; - -message GetInfoRequest {} - -message GetInfoResponse { - string uptime = 1; - int64 available_exchanges = 2; - int64 enabled_exchanges = 3; - string default_forex_provider = 4; - string default_fiat_currency = 5; - map subsystem_status = 6; - map rpc_endpoints = 7; -} - -message GetCommunicationRelayersRequest {} - -message CommunicationRelayer { - bool enabled = 1; - bool connected = 2; -} - -message GetCommunicationRelayersResponse { - map communication_relayers = 1; -} - -message GenericSubsystemRequest { - string subsystem = 1; -} - -message GetSubsystemsRequest {} - -message GetSusbsytemsResponse { - map subsystems_status = 1; -} - -message GetRPCEndpointsRequest{} - -message RPCEndpoint { - bool started = 1; - string listen_address = 2; -} - -message GetRPCEndpointsResponse { - map endpoints = 1; -} - -message GenericExchangeNameRequest { - string exchange = 1; -} - -message GetExchangesRequest { - bool enabled = 1; -} - -message GetExchangesResponse { - string exchanges = 1; -} - -message GetExchangeOTPReponse { - string otp_code = 1; -} - -message GetExchangeOTPsRequest {} - -message GetExchangeOTPsResponse { - map otp_codes = 1; -} - -message DisableExchangeRequest { - string exchange = 1; -} - -message PairsSupported { - string available_pairs = 1; - string enabled_pairs = 2; -} - -message GetExchangeInfoResponse { - string name = 1; - bool enabled = 2; - bool verbose = 3; - bool using_sandbox = 4; - string http_timeout = 5; - string http_useragent = 6; - string http_proxy = 7; - string base_currencies = 8; - map supported_assets = 9; - bool authenticated_api = 10; -} - -message GetTickerRequest { - string exchange = 1; - CurrencyPair pair = 2; - string asset_type = 3; -} - -message CurrencyPair { - string delimiter = 1; - string base = 2; - string quote = 3; -} - -message TickerResponse { - CurrencyPair pair = 1; - int64 last_updated = 2; - string currency_pair = 3; - double last = 4; - double high = 5; - double low = 6; - double bid = 7; - double ask = 8; - double volume = 9; - double price_ath = 10; -} - -message GetTickersRequest {} - -message Tickers { - string exchange = 1; - repeated TickerResponse tickers = 2; -} - -message GetTickersResponse { - repeated Tickers tickers = 1; -} - -message GetOrderbookRequest { - string exchange = 1; - CurrencyPair pair = 2; - string asset_type = 3; -} - -message OrderbookItem { - double amount = 1; - double price = 2; - int64 id = 3; -} - -message OrderbookResponse { - CurrencyPair pair = 1; - string currency_pair = 2; - repeated OrderbookItem bids = 3; - repeated OrderbookItem asks = 4; - int64 last_updated = 5; - string asset_type = 6; -} - -message GetOrderbooksRequest {} - -message Orderbooks { - string exchange = 1; - repeated OrderbookResponse orderbooks = 2; -} - -message GetOrderbooksResponse { - repeated Orderbooks orderbooks = 1; -} - -message GetAccountInfoRequest { - string exchange = 1; - string asset_type = 2; -} - -message Account { - string id = 1; - repeated AccountCurrencyInfo currencies = 2; -} - -message AccountCurrencyInfo { - string currency = 1; - double total_value = 2; - double hold = 3; -} - -message GetAccountInfoResponse { - string exchange = 1; - repeated Account accounts = 2; -} - -message GetConfigRequest {} - -message GetConfigResponse { - bytes data = 1; -} - -message PortfolioAddress { - string address = 1; - string coin_type = 2; - string description = 3; - double balance = 4; -} - -message GetPortfolioRequest {} - -message GetPortfolioResponse { - repeated PortfolioAddress portfolio = 1; -} - -message GetPortfolioSummaryRequest {} - -message Coin { - string coin = 1; - double balance = 2; - string address = 3; - double percentage = 4; -} - -message OfflineCoinSummary { - string address = 1; - double balance = 2; - double percentage = 3; -} - -message OnlineCoinSummary { - double balance = 1; - double percentage = 2; -} - -message OfflineCoins { - repeated OfflineCoinSummary addresses = 1; -} - -message OnlineCoins { - map coins = 1; -} - -message GetPortfolioSummaryResponse { - repeated Coin coin_totals = 1; - repeated Coin coins_offline = 2; - map coins_offline_summary = 3; - repeated Coin coins_online = 4; - map coins_online_summary = 5; -} - -message AddPortfolioAddressRequest { - string address = 1; - string coin_type = 2; - string description = 3; - double balance = 4; - string supported_exchanges = 5; - bool cold_storage = 6; -} - -message RemovePortfolioAddressRequest { - string address = 1; - string coin_type = 2; - string description = 3; -} - -message GetForexProvidersRequest {} - -message ForexProvider { - string name = 1; - bool enabled = 2; - bool verbose = 3; - string rest_polling_delay = 4; - string api_key = 5; - int64 api_key_level =6; - bool primary_provider = 7; -} - -message GetForexProvidersResponse { - repeated ForexProvider forex_providers = 1; -} - -message GetForexRatesRequest {} - -message ForexRatesConversion { - string from = 1; - string to = 2; - double rate = 3; - double inverse_rate = 4; - -} -message GetForexRatesResponse { - repeated ForexRatesConversion forex_rates = 1; -} - -message OrderDetails { - string exchange = 1; - string id = 2; - string client_order_id = 3; - string base_currency = 4; - string quote_currency = 5; - string asset_type = 6; - string order_side = 7; - string order_type = 8; - int64 creation_time = 9; - int64 update_time = 10; - string status = 11; - double price = 12; - double amount = 13; - double open_volume = 14; - double fee = 15; - double cost = 16; - repeated TradeHistory trades = 17; -} - -message TradeHistory { - int64 creation_time = 1; - string id = 2; - double price = 3; - double amount = 4; - string exchange = 5; - string asset_type = 6; - string order_side = 7; - double fee = 8; - double total = 9; -} - -message GetOrdersRequest { - string exchange = 1; - string asset_type = 2; - CurrencyPair pair = 3; - string start_date = 4; - string end_date = 5; -} - -message GetOrdersResponse { - repeated OrderDetails orders = 1; -} - -message GetOrderRequest { - string exchange = 1; - string order_id = 2; - CurrencyPair pair = 3; - string asset = 4; -} - -message SubmitOrderRequest { - string exchange = 1; - CurrencyPair pair = 2; - string side = 3; - string order_type = 4; - double amount = 5; - double price = 6; - string client_id = 7; - string asset_type = 8; -} - -message Trades { - double amount = 1; - double price = 2; - double fee = 3; - string fee_asset = 4; -} - -message SubmitOrderResponse { - bool order_placed = 1; - string order_id = 2; - repeated Trades trades= 3; -} - -message SimulateOrderRequest { - string exchange = 1; - CurrencyPair pair = 2; - double amount = 3; - string side = 4; -} - -message SimulateOrderResponse { - repeated OrderbookItem orders = 1; - double amount = 2; - double minimum_price = 3; - double maximum_price = 4; - double percentage_gain_loss = 5; - string status = 6; -} - -message WhaleBombRequest { - string exchange = 1; - CurrencyPair pair = 2; - double price_target = 3; - string side = 4; -} - -message CancelOrderRequest { - string exchange = 1; - string account_id = 2; - string order_id = 3; - CurrencyPair pair = 4; - string asset_type = 5; - string wallet_address = 6; - string side = 7; -} - -message CancelBatchOrdersRequest { - string exchange = 1; - string account_id = 2; - string orders_id = 3; - CurrencyPair pair = 4; - string asset_type = 5; - string wallet_address = 6; - string side = 7; -} - -message CancelBatchOrdersResponse { - message Orders { - map order_status = 1; - } - repeated Orders orders = 1; -} - -message CancelAllOrdersRequest { - string exchange = 1; -} - -message CancelAllOrdersResponse { - message Orders { - string exchange = 1; - map order_status = 2; - } - repeated Orders orders = 1; - int64 count = 2; -} - -message GetEventsRequest {} - - -message ConditionParams { - string condition = 1; - double price = 2; - bool check_bids = 3; - bool check_bids_and_asks = 4; - double orderbook_amount = 5; -} - -message GetEventsResponse { - int64 id = 1; - string exchange = 2; - string item = 3; - ConditionParams condition_params = 4; - CurrencyPair pair = 5; - string action = 6; - bool executed = 7; -} - -message AddEventRequest { - string exchange = 1; - string item = 2; - ConditionParams condition_params = 3; - CurrencyPair pair = 4; - string asset_type = 5; - string action = 6; -} - -message AddEventResponse { - int64 id = 1; -} - -message RemoveEventRequest { - int64 id = 1; -} - -message GetCryptocurrencyDepositAddressesRequest { - string exchange = 1; -} - -message GetCryptocurrencyDepositAddressesResponse { - map addresses = 1; -} - -message GetCryptocurrencyDepositAddressRequest { - string exchange = 1; - string cryptocurrency = 2; -} - -message GetCryptocurrencyDepositAddressResponse { - string address = 1; -} - -message WithdrawFiatRequest { - string exchange = 1; - string currency = 2; - double amount = 3; - string description = 4; - string bank_account_id = 5; -} - -message WithdrawCryptoRequest { - string exchange = 1; - string address = 2; - string address_tag = 3; - string currency = 4; - double amount = 5; - double fee = 6; - string description = 7; -} - -message WithdrawResponse { - string id = 1; - string status = 2; -} - -message WithdrawalEventByIDRequest { - string id = 1; -} - -message WithdrawalEventByIDResponse { - WithdrawalEventResponse event = 2; -} - -message WithdrawalEventsByExchangeRequest { - string exchange = 1; - string id = 2; - int32 limit = 3; - string currency = 4; -} - -message WithdrawalEventsByDateRequest { - string exchange = 1; - string start = 2; - string end = 3; - int32 limit = 4; -} - -message WithdrawalEventsByExchangeResponse { - repeated WithdrawalEventResponse event = 2; -} - -message WithdrawalEventResponse { - string id = 2; - WithdrawlExchangeEvent exchange = 3; - WithdrawalRequestEvent request = 4; - google.protobuf.Timestamp created_at = 5; - google.protobuf.Timestamp updated_at = 6; -} - -message WithdrawlExchangeEvent { - string name = 1; - string id = 2; - string status = 3; -} - -message WithdrawalRequestEvent { - string currency = 2; - string description = 3; - double amount = 4; - int32 type = 5; - FiatWithdrawalEvent fiat = 6; - CryptoWithdrawalEvent crypto = 7; -} - -message FiatWithdrawalEvent { - string bank_name = 1; - string account_name = 2; - string account_number = 3; - string bsb = 4; - string swift = 5; - string iban = 6; -} - -message CryptoWithdrawalEvent { - string address = 1; - string address_tag = 2; - double fee = 3; - string tx_id = 4; -} - -message GetLoggerDetailsRequest { - string logger = 1; -} - -message GetLoggerDetailsResponse{ - bool info = 1; - bool debug = 2; - bool warn = 3; - bool error = 4; -} - -message SetLoggerDetailsRequest { - string logger = 1; - string level = 2; -} - -message GetExchangePairsRequest { - string exchange = 1; - string asset = 2; -} - -message GetExchangePairsResponse { - map supported_assets = 1; -} - -message SetExchangePairRequest { - string exchange = 1; - string asset_type = 2; - repeated CurrencyPair pairs = 3; - bool enable = 4; -} - -message GetOrderbookStreamRequest { - string exchange = 1; - CurrencyPair pair = 2; - string asset_type = 3; -} - -message GetExchangeOrderbookStreamRequest { - string exchange = 1; -} - -message GetTickerStreamRequest { - string exchange = 1; - CurrencyPair pair = 2; - string asset_type = 3; -} - -message GetExchangeTickerStreamRequest { - string exchange = 1; -} - -message GetAuditEventRequest { - string start_date = 1; - string end_date = 2; - string order_by = 3; - int32 limit = 4; - int32 offset = 5; -} - -message GetAuditEventResponse { - repeated AuditEvent events = 1; -} - -message GetSavedTradesRequest { - string exchange = 1; - CurrencyPair pair = 2; - string asset_type = 3; - string start = 4; - string end = 5; -} - -message SavedTrades { - double price = 1; - double amount = 2; - string side = 3; - string timestamp = 4; - string trade_id = 5; -} - -message SavedTradesResponse { - string exchange_name = 1; - string asset = 2; - CurrencyPair pair = 3; - repeated SavedTrades trades = 4; -} - -message ConvertTradesToCandlesRequest { - string exchange = 1; - CurrencyPair pair = 2; - string asset_type = 3; - string start = 4; - string end = 5; - int64 time_interval = 6; - bool sync = 7; - bool force = 8; -} - -message GetHistoricCandlesRequest { - string exchange = 1; - CurrencyPair pair = 2; - string asset_type = 3; - string start = 4; - string end = 5; - int64 time_interval = 6; - bool ex_request = 7; - bool sync = 8; - bool use_db = 9; - bool fill_missing_with_trades = 10; - bool force = 11; -} - -message GetHistoricCandlesResponse { - string exchange = 1; - CurrencyPair pair = 2; - string start = 3; - string end = 4; - string interval = 6; - repeated Candle candle = 5; -} - -message Candle { - string time = 1; - double low = 2; - double high = 3; - double open = 4; - double close = 5; - double volume = 6; -} - -message AuditEvent { - string type = 1; - string identifier = 2; - string message = 3; - string timestamp = 4; -} - -message GCTScript { - string UUID = 1; - string name = 2; - string path = 3; - string next_run = 4; -} - -message GCTScriptExecuteRequest { - GCTScript script = 1; -} - -message GCTScriptStopRequest { - GCTScript script = 1; -} - -message GCTScriptStopAllRequest{} -message GCTScriptStatusRequest {} -message GCTScriptListAllRequest{} - -message GCTScriptUploadRequest { - string script_name = 1; - string script_data = 2; - bytes data = 3; - bool archived = 4; - bool overwrite = 5; -} - -message GCTScriptReadScriptRequest{ - GCTScript script = 1; -} - -message GCTScriptQueryRequest{ - GCTScript script = 1; -} - -message GCTScriptAutoLoadRequest{ - string script = 1; - bool status = 2; -} - -message GCTScriptStatusResponse{ - string status = 1; - repeated GCTScript scripts = 2; -} - -message GCTScriptQueryResponse{ - string status = 1; - GCTScript script = 2; - string data = 3; -} - -message GenericResponse { - string status = 1; - string data = 2; -} - -message SetExchangeAssetRequest { - string exchange = 1; - string asset = 2; - bool enable = 3; -} - -message SetExchangeAllPairsRequest { - string exchange = 1; - bool enable = 2; -} - -message UpdateExchangeSupportedPairsRequest { - string exchange = 1; -} - -message GetExchangeAssetsRequest { - string exchange = 1; -} - -message GetExchangeAssetsResponse { - string assets = 1; -} - -message WebsocketGetInfoRequest { - string exchange = 1; -} - -message WebsocketGetInfoResponse { - string exchange = 1; - bool supported = 2; - bool enabled = 3; - bool authenticated_supported = 4; - bool authenticated = 5; - string running_url = 6; - string proxy_address = 7; -} - -message WebsocketSetEnabledRequest { - string exchange = 1; - bool enable = 2; -} - -message WebsocketGetSubscriptionsRequest { - string exchange = 1; -} - -message WebsocketSubscription { - string channel = 1; - string currency = 2; - string asset = 3; - string params = 4; -} - -message WebsocketGetSubscriptionsResponse { - string exchange = 1; - repeated WebsocketSubscription subscriptions = 2; -} - -message WebsocketSetProxyRequest { - string exchange = 1; - string proxy = 2; -} - -message WebsocketSetURLRequest { - string exchange = 1; - string url = 2; -} - -message FindMissingCandlePeriodsRequest { - string exchange_name = 1; - string asset_type = 2; - CurrencyPair pair = 3; - int64 interval = 4; - string start = 5; - string end = 6; -} - -message FindMissingTradePeriodsRequest { - string exchange_name = 1; - string asset_type = 2; - CurrencyPair pair = 3; - string start = 4; - string end = 5; -} - -message FindMissingIntervalsResponse { - string exchange_name = 1; - string asset_type = 2; - CurrencyPair pair = 3; - repeated string missing_periods = 4; - string status = 5; -} - -message SetExchangeTradeProcessingRequest { - string exchange = 1; - bool status = 2; -} - -service GoCryptoTrader { - rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) { - option (google.api.http) = { - get :"/v1/getinfo" - }; - } - - rpc GetSubsystems (GetSubsystemsRequest) returns (GetSusbsytemsResponse) { - option (google.api.http) = { - get: "/v1/getsubsystems" - }; - } - - rpc EnableSubsystem (GenericSubsystemRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/enablesubsystem" - }; - } - - rpc DisableSubsystem (GenericSubsystemRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/disablesubsystem" - }; - } - - rpc GetRPCEndpoints (GetRPCEndpointsRequest) returns (GetRPCEndpointsResponse) { - option (google.api.http) = { - get: "/v1/getrpcendpoints" - }; - } - - rpc GetCommunicationRelayers (GetCommunicationRelayersRequest) returns (GetCommunicationRelayersResponse) { - option (google.api.http) = { - get: "/v1/getcommunicationrelayers" - }; - } - - rpc GetExchanges (GetExchangesRequest) returns (GetExchangesResponse) { - option (google.api.http) = { - get: "/v1/getexchanges" - }; - } - - rpc DisableExchange (GenericExchangeNameRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/disableexchange" - body: "*" - }; - } - - rpc GetExchangeInfo (GenericExchangeNameRequest) returns (GetExchangeInfoResponse) { - option (google.api.http) = { - get: "/v1/getexchangeinfo" - }; - } - - rpc GetExchangeOTPCode (GenericExchangeNameRequest) returns (GetExchangeOTPReponse) { - option (google.api.http) = { - get: "/v1/getexchangeotp" - }; - } - - rpc GetExchangeOTPCodes (GetExchangeOTPsRequest) returns (GetExchangeOTPsResponse) { - option (google.api.http) = { - get: "/v1/getexchangeotps" - }; - } - - rpc EnableExchange (GenericExchangeNameRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/enableexchange" - body: "*" - }; - } - - rpc GetTicker (GetTickerRequest) returns (TickerResponse) { - option (google.api.http) = { - post: "/v1/getticker" - body: "*" - }; - } - - rpc GetTickers (GetTickersRequest) returns (GetTickersResponse) { - option (google.api.http) = { - get: "/v1/gettickers" - }; - } - - rpc GetOrderbook (GetOrderbookRequest) returns (OrderbookResponse) { - option (google.api.http) = { - post: "/v1/getorderbook" - body: "*" - }; - } - - rpc GetOrderbooks (GetOrderbooksRequest) returns (GetOrderbooksResponse) { - option (google.api.http) = { - get: "/v1/getorderbooks" - }; - } - - rpc GetAccountInfo (GetAccountInfoRequest) returns (GetAccountInfoResponse) { - option (google.api.http) = { - get: "/v1/getaccountinfo" - }; - } - - rpc UpdateAccountInfo (GetAccountInfoRequest) returns (GetAccountInfoResponse) { - option (google.api.http) = { - get: "/v1/updateaccountinfo" - }; - } - - rpc GetAccountInfoStream (GetAccountInfoRequest) returns (stream GetAccountInfoResponse) { - option (google.api.http) = { - get: "/v1/getaccountinfostream" - }; - } - - rpc GetConfig (GetConfigRequest) returns (GetConfigResponse) { - option (google.api.http) = { - get: "/v1/getconfig" - }; - } - - rpc GetPortfolio (GetPortfolioRequest) returns (GetPortfolioResponse) { - option (google.api.http) = { - get: "/v1/getportfolio" - }; - } - - rpc GetPortfolioSummary (GetPortfolioSummaryRequest) returns (GetPortfolioSummaryResponse) { - option (google.api.http) = { - get: "/v1/getportfoliosummary" - }; - } - - - rpc AddPortfolioAddress (AddPortfolioAddressRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/addportfolioaddress" - body: "*" - }; - } - - rpc RemovePortfolioAddress (RemovePortfolioAddressRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/removeportfolioaddress" - body: "*" - }; - } - - rpc GetForexProviders (GetForexProvidersRequest) returns (GetForexProvidersResponse) { - option (google.api.http) = { - get: "/v1/getforexproviders" - }; - } - - rpc GetForexRates (GetForexRatesRequest) returns (GetForexRatesResponse) { - option (google.api.http) = { - get: "/v1/getforexrates" - }; - } - - rpc GetOrders (GetOrdersRequest) returns (GetOrdersResponse) { - option (google.api.http) = { - post: "/v1/getorders" - body: "*" - }; - } - - rpc GetOrder (GetOrderRequest) returns (OrderDetails) { - option (google.api.http) = { - post: "/v1/getorder" - body: "*" - }; - } - - rpc SubmitOrder (SubmitOrderRequest) returns (SubmitOrderResponse) { - option (google.api.http) = { - post: "/v1/submitorder" - body: "*" - }; - } - - rpc SimulateOrder (SimulateOrderRequest) returns (SimulateOrderResponse) { - option (google.api.http) = { - post: "/v1/simulateorder" - body: "*" - }; - } - - rpc WhaleBomb (WhaleBombRequest) returns (SimulateOrderResponse) { - option (google.api.http) = { - post: "/v1/whalebomb" - body: "*" - }; - } - - rpc CancelOrder (CancelOrderRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/cancelorder" - body: "*" - }; - } - - rpc CancelBatchOrders (CancelBatchOrdersRequest) returns (CancelBatchOrdersResponse) { - option (google.api.http) = { - post: "/v1/cancelbatchorders" - body: "*" - }; - } - - rpc CancelAllOrders (CancelAllOrdersRequest) returns (CancelAllOrdersResponse) { - option (google.api.http) = { - post: "/v1/cancelallorders" - body: "*" - }; - } - - rpc GetEvents(GetEventsRequest) returns (GetEventsResponse) { - option (google.api.http) = { - get: "/v1/getevents" - }; - } - - rpc AddEvent(AddEventRequest) returns (AddEventResponse) { - option (google.api.http) = { - post: "/v1/addevent" - body: "*" - }; - } - - rpc RemoveEvent(RemoveEventRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/removeevent" - body: "*" - }; - } - - rpc GetCryptocurrencyDepositAddresses(GetCryptocurrencyDepositAddressesRequest) returns (GetCryptocurrencyDepositAddressesResponse) { - option (google.api.http) = { - post: "/v1/getcryptodepositaddresses" - body: "*" - }; - } - - rpc GetCryptocurrencyDepositAddress(GetCryptocurrencyDepositAddressRequest) returns (GetCryptocurrencyDepositAddressResponse) { - option (google.api.http) = { - post: "/v1/getcryptodepositaddress" - body: "*" - }; - } - - - rpc WithdrawFiatFunds(WithdrawFiatRequest) returns (WithdrawResponse) { - option (google.api.http) = { - post: "/v1/withdrawfiatfunds" - body: "*" - }; - } - - rpc WithdrawCryptocurrencyFunds(WithdrawCryptoRequest) returns (WithdrawResponse) { - option (google.api.http) = { - post: "/v1/withdrawithdrawcryptofundswfiatfunds" - body: "*" - }; - } - - rpc WithdrawalEventByID(WithdrawalEventByIDRequest) returns (WithdrawalEventByIDResponse) { - option (google.api.http) = { - post: "/v1/withdrawaleventbyid" - body: "*" - }; - } - - rpc WithdrawalEventsByExchange(WithdrawalEventsByExchangeRequest) returns (WithdrawalEventsByExchangeResponse) { - option (google.api.http) = { - post: "/v1/withdrawaleventbyid" - body: "*" - }; - } - - rpc WithdrawalEventsByDate(WithdrawalEventsByDateRequest) returns (WithdrawalEventsByExchangeResponse) { - option (google.api.http) = { - post: "/v1/withdrawaleventbydate" - body: "*" - }; - } - - rpc GetLoggerDetails(GetLoggerDetailsRequest) returns (GetLoggerDetailsResponse) { - option (google.api.http) = { - get: "/v1/getloggerdetails" - }; - } - - rpc SetLoggerDetails(SetLoggerDetailsRequest) returns (GetLoggerDetailsResponse) { - option (google.api.http) = { - post: "/v1/setloggerdetails", - body: "*" - }; - } - - rpc GetExchangePairs(GetExchangePairsRequest) returns (GetExchangePairsResponse) { - option (google.api.http) = { - post: "/v1/getexchangepairs", - body: "*" - }; - } - - rpc SetExchangePair(SetExchangePairRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/setexchangepair", - body: "*" - }; - } - - rpc GetOrderbookStream(GetOrderbookStreamRequest) returns (stream OrderbookResponse) { - option (google.api.http) = { - get: "/v1/getorderbookstream" - }; - } - - rpc GetExchangeOrderbookStream(GetExchangeOrderbookStreamRequest) returns (stream OrderbookResponse) { - option (google.api.http) = { - get: "/v1/getexchangeorderbookstream" - }; - } - - rpc GetTickerStream(GetTickerStreamRequest) returns (stream TickerResponse) { - option (google.api.http) = { - get: "/v1/gettickerstream" - }; - } - - rpc GetExchangeTickerStream(GetExchangeTickerStreamRequest) returns (stream TickerResponse) { - option (google.api.http) = { - get: "/v1/getexchangetickerstream", - }; - } - - rpc GetAuditEvent(GetAuditEventRequest) returns (GetAuditEventResponse) { - option (google.api.http) = { - get: "/v1/getauditevent", - }; - } - - rpc GCTScriptExecute(GCTScriptExecuteRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/gctscript/execute", - }; - } - - rpc GCTScriptUpload(GCTScriptUploadRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/gctscript/upload", - body: "*" - }; - } - - rpc GCTScriptReadScript(GCTScriptReadScriptRequest) returns (GCTScriptQueryResponse) { - option (google.api.http) = { - post: "/v1/gctscript/read", - body: "*" - }; - } - - rpc GCTScriptStatus(GCTScriptStatusRequest) returns (GCTScriptStatusResponse) { - option (google.api.http) = { - get: "/v1/gctscript/status", - }; - } - - rpc GCTScriptQuery(GCTScriptQueryRequest) returns (GCTScriptQueryResponse) { - option (google.api.http) = { - get: "/v1/gctscript/query", - }; - } - - rpc GCTScriptStop(GCTScriptStopRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/gctscript/stop", - body: "*" - }; - } - - rpc GCTScriptStopAll(GCTScriptStopAllRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/gctscript/stop", - body: "*" - }; - } - - rpc GCTScriptListAll(GCTScriptListAllRequest) returns (GCTScriptStatusResponse) { - option (google.api.http) = { - post: "/v1/gctscript/stop", - body: "*" - }; - } - rpc GCTScriptAutoLoadToggle(GCTScriptAutoLoadRequest) returns (GenericResponse) { - option (google.api.http) = { - post: "/v1/gctscript/autoload", - body: "*" - }; - } - - rpc GetHistoricCandles(GetHistoricCandlesRequest) returns (GetHistoricCandlesResponse) { - option (google.api.http) = { - get: "/v1/gethistoriccandles" - }; - } - - rpc SetExchangeAsset(SetExchangeAssetRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/setexchangeasset" - }; - } - - rpc SetAllExchangePairs(SetExchangeAllPairsRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/setallexchangepairs" - }; - } - - rpc UpdateExchangeSupportedPairs(UpdateExchangeSupportedPairsRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/updateexchangesupportedpairs" - }; - } - - rpc GetExchangeAssets(GetExchangeAssetsRequest) returns (GetExchangeAssetsResponse) { - option (google.api.http) = { - get: "/v1/getexchangeassets" - }; - } - - rpc WebsocketGetInfo(WebsocketGetInfoRequest) returns (WebsocketGetInfoResponse) { - option (google.api.http) = { - get: "/v1/websocketgetinfo" - }; - } - - rpc WebsocketSetEnabled(WebsocketSetEnabledRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/websocketsetenabled" - }; - } - - rpc WebsocketGetSubscriptions(WebsocketGetSubscriptionsRequest) returns (WebsocketGetSubscriptionsResponse) { - option (google.api.http) = { - get: "/v1/websocketgetsubscriptions" - }; - } - - rpc WebsocketSetProxy(WebsocketSetProxyRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/websocketsetproxy" - }; - } - - rpc WebsocketSetURL(WebsocketSetURLRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/websocketseturl" - }; - } - - rpc GetRecentTrades(GetSavedTradesRequest) returns (SavedTradesResponse) { - option (google.api.http) = { - get: "/v1/getsavedtrades" - }; - } - - rpc GetHistoricTrades(GetSavedTradesRequest) returns (stream SavedTradesResponse) { - option (google.api.http) = { - get: "/v1/getsavedtrades" - }; - } - - rpc GetSavedTrades(GetSavedTradesRequest) returns (SavedTradesResponse) { - option (google.api.http) = { - get: "/v1/getsavedtrades" - }; - } - - rpc ConvertTradesToCandles (ConvertTradesToCandlesRequest) returns (GetHistoricCandlesResponse) { - option (google.api.http) = { - get: "/v1/converttradestocandles" - }; - } - - rpc FindMissingSavedCandleIntervals (FindMissingCandlePeriodsRequest) returns (FindMissingIntervalsResponse) { - option (google.api.http) = { - get: "/v1/findmissingsavedcandleintervals" - }; - } - - rpc FindMissingSavedTradeIntervals (FindMissingTradePeriodsRequest) returns (FindMissingIntervalsResponse) { - option (google.api.http) = { - get: "/v1/findmissingsavedtradeintervals" - }; - } - - rpc SetExchangeTradeProcessing (SetExchangeTradeProcessingRequest) returns (GenericResponse) { - option (google.api.http) = { - get: "/v1/setexchangetradeprocessing" - }; - } +syntax = "proto3"; +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +package gctrpc; +option go_package = "github.com/thrasher-corp/gocryptotrader/gctrpc"; + +message GetInfoRequest {} + +message GetInfoResponse { + string uptime = 1; + int64 available_exchanges = 2; + int64 enabled_exchanges = 3; + string default_forex_provider = 4; + string default_fiat_currency = 5; + map subsystem_status = 6; + map rpc_endpoints = 7; +} + +message GetCommunicationRelayersRequest {} + +message CommunicationRelayer { + bool enabled = 1; + bool connected = 2; +} + +message GetCommunicationRelayersResponse { + map communication_relayers = 1; +} + +message GenericSubsystemRequest { + string subsystem = 1; +} + +message GetSubsystemsRequest {} + +message GetSusbsytemsResponse { + map subsystems_status = 1; +} + +message GetRPCEndpointsRequest{} + +message RPCEndpoint { + bool started = 1; + string listen_address = 2; +} + +message GetRPCEndpointsResponse { + map endpoints = 1; +} + +message GenericExchangeNameRequest { + string exchange = 1; +} + +message GetExchangesRequest { + bool enabled = 1; +} + +message GetExchangesResponse { + string exchanges = 1; +} + +message GetExchangeOTPReponse { + string otp_code = 1; +} + +message GetExchangeOTPsRequest {} + +message GetExchangeOTPsResponse { + map otp_codes = 1; +} + +message DisableExchangeRequest { + string exchange = 1; +} + +message PairsSupported { + string available_pairs = 1; + string enabled_pairs = 2; +} + +message GetExchangeInfoResponse { + string name = 1; + bool enabled = 2; + bool verbose = 3; + bool using_sandbox = 4; + string http_timeout = 5; + string http_useragent = 6; + string http_proxy = 7; + string base_currencies = 8; + map supported_assets = 9; + bool authenticated_api = 10; +} + +message GetTickerRequest { + string exchange = 1; + CurrencyPair pair = 2; + string asset_type = 3; +} + +message CurrencyPair { + string delimiter = 1; + string base = 2; + string quote = 3; +} + +message TickerResponse { + CurrencyPair pair = 1; + int64 last_updated = 2; + string currency_pair = 3; + double last = 4; + double high = 5; + double low = 6; + double bid = 7; + double ask = 8; + double volume = 9; + double price_ath = 10; +} + +message GetTickersRequest {} + +message Tickers { + string exchange = 1; + repeated TickerResponse tickers = 2; +} + +message GetTickersResponse { + repeated Tickers tickers = 1; +} + +message GetOrderbookRequest { + string exchange = 1; + CurrencyPair pair = 2; + string asset_type = 3; +} + +message OrderbookItem { + double amount = 1; + double price = 2; + int64 id = 3; +} + +message OrderbookResponse { + CurrencyPair pair = 1; + string currency_pair = 2; + repeated OrderbookItem bids = 3; + repeated OrderbookItem asks = 4; + int64 last_updated = 5; + string asset_type = 6; +} + +message GetOrderbooksRequest {} + +message Orderbooks { + string exchange = 1; + repeated OrderbookResponse orderbooks = 2; +} + +message GetOrderbooksResponse { + repeated Orderbooks orderbooks = 1; +} + +message GetAccountInfoRequest { + string exchange = 1; + string asset_type = 2; +} + +message Account { + string id = 1; + repeated AccountCurrencyInfo currencies = 2; +} + +message AccountCurrencyInfo { + string currency = 1; + double total_value = 2; + double hold = 3; +} + +message GetAccountInfoResponse { + string exchange = 1; + repeated Account accounts = 2; +} + +message GetConfigRequest {} + +message GetConfigResponse { + bytes data = 1; +} + +message PortfolioAddress { + string address = 1; + string coin_type = 2; + string description = 3; + double balance = 4; +} + +message GetPortfolioRequest {} + +message GetPortfolioResponse { + repeated PortfolioAddress portfolio = 1; +} + +message GetPortfolioSummaryRequest {} + +message Coin { + string coin = 1; + double balance = 2; + string address = 3; + double percentage = 4; +} + +message OfflineCoinSummary { + string address = 1; + double balance = 2; + double percentage = 3; +} + +message OnlineCoinSummary { + double balance = 1; + double percentage = 2; +} + +message OfflineCoins { + repeated OfflineCoinSummary addresses = 1; +} + +message OnlineCoins { + map coins = 1; +} + +message GetPortfolioSummaryResponse { + repeated Coin coin_totals = 1; + repeated Coin coins_offline = 2; + map coins_offline_summary = 3; + repeated Coin coins_online = 4; + map coins_online_summary = 5; +} + +message AddPortfolioAddressRequest { + string address = 1; + string coin_type = 2; + string description = 3; + double balance = 4; + string supported_exchanges = 5; + bool cold_storage = 6; +} + +message RemovePortfolioAddressRequest { + string address = 1; + string coin_type = 2; + string description = 3; +} + +message GetForexProvidersRequest {} + +message ForexProvider { + string name = 1; + bool enabled = 2; + bool verbose = 3; + string rest_polling_delay = 4; + string api_key = 5; + int64 api_key_level =6; + bool primary_provider = 7; +} + +message GetForexProvidersResponse { + repeated ForexProvider forex_providers = 1; +} + +message GetForexRatesRequest {} + +message ForexRatesConversion { + string from = 1; + string to = 2; + double rate = 3; + double inverse_rate = 4; + +} +message GetForexRatesResponse { + repeated ForexRatesConversion forex_rates = 1; +} + +message OrderDetails { + string exchange = 1; + string id = 2; + string client_order_id = 3; + string base_currency = 4; + string quote_currency = 5; + string asset_type = 6; + string order_side = 7; + string order_type = 8; + int64 creation_time = 9; + int64 update_time = 10; + string status = 11; + double price = 12; + double amount = 13; + double open_volume = 14; + double fee = 15; + double cost = 16; + repeated TradeHistory trades = 17; +} + +message TradeHistory { + int64 creation_time = 1; + string id = 2; + double price = 3; + double amount = 4; + string exchange = 5; + string asset_type = 6; + string order_side = 7; + double fee = 8; + double total = 9; +} + +message GetOrdersRequest { + string exchange = 1; + string asset_type = 2; + CurrencyPair pair = 3; + string start_date = 4; + string end_date = 5; +} + +message GetOrdersResponse { + repeated OrderDetails orders = 1; +} + +message GetOrderRequest { + string exchange = 1; + string order_id = 2; + CurrencyPair pair = 3; + string asset = 4; +} + +message SubmitOrderRequest { + string exchange = 1; + CurrencyPair pair = 2; + string side = 3; + string order_type = 4; + double amount = 5; + double price = 6; + string client_id = 7; + string asset_type = 8; +} + +message Trades { + double amount = 1; + double price = 2; + double fee = 3; + string fee_asset = 4; +} + +message SubmitOrderResponse { + bool order_placed = 1; + string order_id = 2; + repeated Trades trades= 3; +} + +message SimulateOrderRequest { + string exchange = 1; + CurrencyPair pair = 2; + double amount = 3; + string side = 4; +} + +message SimulateOrderResponse { + repeated OrderbookItem orders = 1; + double amount = 2; + double minimum_price = 3; + double maximum_price = 4; + double percentage_gain_loss = 5; + string status = 6; +} + +message WhaleBombRequest { + string exchange = 1; + CurrencyPair pair = 2; + double price_target = 3; + string side = 4; +} + +message CancelOrderRequest { + string exchange = 1; + string account_id = 2; + string order_id = 3; + CurrencyPair pair = 4; + string asset_type = 5; + string wallet_address = 6; + string side = 7; +} + +message CancelBatchOrdersRequest { + string exchange = 1; + string account_id = 2; + string orders_id = 3; + CurrencyPair pair = 4; + string asset_type = 5; + string wallet_address = 6; + string side = 7; +} + +message CancelBatchOrdersResponse { + message Orders { + map order_status = 1; + } + repeated Orders orders = 1; +} + +message CancelAllOrdersRequest { + string exchange = 1; +} + +message CancelAllOrdersResponse { + message Orders { + string exchange = 1; + map order_status = 2; + } + repeated Orders orders = 1; + int64 count = 2; +} + +message GetEventsRequest {} + + +message ConditionParams { + string condition = 1; + double price = 2; + bool check_bids = 3; + bool check_bids_and_asks = 4; + double orderbook_amount = 5; +} + +message GetEventsResponse { + int64 id = 1; + string exchange = 2; + string item = 3; + ConditionParams condition_params = 4; + CurrencyPair pair = 5; + string action = 6; + bool executed = 7; +} + +message AddEventRequest { + string exchange = 1; + string item = 2; + ConditionParams condition_params = 3; + CurrencyPair pair = 4; + string asset_type = 5; + string action = 6; +} + +message AddEventResponse { + int64 id = 1; +} + +message RemoveEventRequest { + int64 id = 1; +} + +message GetCryptocurrencyDepositAddressesRequest { + string exchange = 1; +} + +message GetCryptocurrencyDepositAddressesResponse { + map addresses = 1; +} + +message GetCryptocurrencyDepositAddressRequest { + string exchange = 1; + string cryptocurrency = 2; +} + +message GetCryptocurrencyDepositAddressResponse { + string address = 1; +} + +message WithdrawFiatRequest { + string exchange = 1; + string currency = 2; + double amount = 3; + string description = 4; + string bank_account_id = 5; +} + +message WithdrawCryptoRequest { + string exchange = 1; + string address = 2; + string address_tag = 3; + string currency = 4; + double amount = 5; + double fee = 6; + string description = 7; +} + +message WithdrawResponse { + string id = 1; + string status = 2; +} + +message WithdrawalEventByIDRequest { + string id = 1; +} + +message WithdrawalEventByIDResponse { + WithdrawalEventResponse event = 2; +} + +message WithdrawalEventsByExchangeRequest { + string exchange = 1; + string id = 2; + int32 limit = 3; + string currency = 4; +} + +message WithdrawalEventsByDateRequest { + string exchange = 1; + string start = 2; + string end = 3; + int32 limit = 4; +} + +message WithdrawalEventsByExchangeResponse { + repeated WithdrawalEventResponse event = 2; +} + +message WithdrawalEventResponse { + string id = 2; + WithdrawlExchangeEvent exchange = 3; + WithdrawalRequestEvent request = 4; + google.protobuf.Timestamp created_at = 5; + google.protobuf.Timestamp updated_at = 6; +} + +message WithdrawlExchangeEvent { + string name = 1; + string id = 2; + string status = 3; +} + +message WithdrawalRequestEvent { + string currency = 2; + string description = 3; + double amount = 4; + int32 type = 5; + FiatWithdrawalEvent fiat = 6; + CryptoWithdrawalEvent crypto = 7; +} + +message FiatWithdrawalEvent { + string bank_name = 1; + string account_name = 2; + string account_number = 3; + string bsb = 4; + string swift = 5; + string iban = 6; +} + +message CryptoWithdrawalEvent { + string address = 1; + string address_tag = 2; + double fee = 3; + string tx_id = 4; +} + +message GetLoggerDetailsRequest { + string logger = 1; +} + +message GetLoggerDetailsResponse{ + bool info = 1; + bool debug = 2; + bool warn = 3; + bool error = 4; +} + +message SetLoggerDetailsRequest { + string logger = 1; + string level = 2; +} + +message GetExchangePairsRequest { + string exchange = 1; + string asset = 2; +} + +message GetExchangePairsResponse { + map supported_assets = 1; +} + +message SetExchangePairRequest { + string exchange = 1; + string asset_type = 2; + repeated CurrencyPair pairs = 3; + bool enable = 4; +} + +message GetOrderbookStreamRequest { + string exchange = 1; + CurrencyPair pair = 2; + string asset_type = 3; +} + +message GetExchangeOrderbookStreamRequest { + string exchange = 1; +} + +message GetTickerStreamRequest { + string exchange = 1; + CurrencyPair pair = 2; + string asset_type = 3; +} + +message GetExchangeTickerStreamRequest { + string exchange = 1; +} + +message GetAuditEventRequest { + string start_date = 1; + string end_date = 2; + string order_by = 3; + int32 limit = 4; + int32 offset = 5; +} + +message GetAuditEventResponse { + repeated AuditEvent events = 1; +} + +message GetSavedTradesRequest { + string exchange = 1; + CurrencyPair pair = 2; + string asset_type = 3; + string start = 4; + string end = 5; +} + +message SavedTrades { + double price = 1; + double amount = 2; + string side = 3; + string timestamp = 4; + string trade_id = 5; +} + +message SavedTradesResponse { + string exchange_name = 1; + string asset = 2; + CurrencyPair pair = 3; + repeated SavedTrades trades = 4; +} + +message ConvertTradesToCandlesRequest { + string exchange = 1; + CurrencyPair pair = 2; + string asset_type = 3; + string start = 4; + string end = 5; + int64 time_interval = 6; + bool sync = 7; + bool force = 8; +} + +message GetHistoricCandlesRequest { + string exchange = 1; + CurrencyPair pair = 2; + string asset_type = 3; + string start = 4; + string end = 5; + int64 time_interval = 6; + bool ex_request = 7; + bool sync = 8; + bool use_db = 9; + bool fill_missing_with_trades = 10; + bool force = 11; +} + +message GetHistoricCandlesResponse { + string exchange = 1; + CurrencyPair pair = 2; + string start = 3; + string end = 4; + string interval = 6; + repeated Candle candle = 5; +} + +message Candle { + string time = 1; + double low = 2; + double high = 3; + double open = 4; + double close = 5; + double volume = 6; +} + +message AuditEvent { + string type = 1; + string identifier = 2; + string message = 3; + string timestamp = 4; +} + +message GCTScript { + string UUID = 1; + string name = 2; + string path = 3; + string next_run = 4; +} + +message GCTScriptExecuteRequest { + GCTScript script = 1; +} + +message GCTScriptStopRequest { + GCTScript script = 1; +} + +message GCTScriptStopAllRequest{} +message GCTScriptStatusRequest {} +message GCTScriptListAllRequest{} + +message GCTScriptUploadRequest { + string script_name = 1; + string script_data = 2; + bytes data = 3; + bool archived = 4; + bool overwrite = 5; +} + +message GCTScriptReadScriptRequest{ + GCTScript script = 1; +} + +message GCTScriptQueryRequest{ + GCTScript script = 1; +} + +message GCTScriptAutoLoadRequest{ + string script = 1; + bool status = 2; +} + +message GCTScriptStatusResponse{ + string status = 1; + repeated GCTScript scripts = 2; +} + +message GCTScriptQueryResponse{ + string status = 1; + GCTScript script = 2; + string data = 3; +} + +message GenericResponse { + string status = 1; + string data = 2; +} + +message SetExchangeAssetRequest { + string exchange = 1; + string asset = 2; + bool enable = 3; +} + +message SetExchangeAllPairsRequest { + string exchange = 1; + bool enable = 2; +} + +message UpdateExchangeSupportedPairsRequest { + string exchange = 1; +} + +message GetExchangeAssetsRequest { + string exchange = 1; +} + +message GetExchangeAssetsResponse { + string assets = 1; +} + +message WebsocketGetInfoRequest { + string exchange = 1; +} + +message WebsocketGetInfoResponse { + string exchange = 1; + bool supported = 2; + bool enabled = 3; + bool authenticated_supported = 4; + bool authenticated = 5; + string running_url = 6; + string proxy_address = 7; +} + +message WebsocketSetEnabledRequest { + string exchange = 1; + bool enable = 2; +} + +message WebsocketGetSubscriptionsRequest { + string exchange = 1; +} + +message WebsocketSubscription { + string channel = 1; + string currency = 2; + string asset = 3; + string params = 4; +} + +message WebsocketGetSubscriptionsResponse { + string exchange = 1; + repeated WebsocketSubscription subscriptions = 2; +} + +message WebsocketSetProxyRequest { + string exchange = 1; + string proxy = 2; +} + +message WebsocketSetURLRequest { + string exchange = 1; + string url = 2; +} + +message FindMissingCandlePeriodsRequest { + string exchange_name = 1; + string asset_type = 2; + CurrencyPair pair = 3; + int64 interval = 4; + string start = 5; + string end = 6; +} + +message FindMissingTradePeriodsRequest { + string exchange_name = 1; + string asset_type = 2; + CurrencyPair pair = 3; + string start = 4; + string end = 5; +} + +message FindMissingIntervalsResponse { + string exchange_name = 1; + string asset_type = 2; + CurrencyPair pair = 3; + repeated string missing_periods = 4; + string status = 5; +} + +message SetExchangeTradeProcessingRequest { + string exchange = 1; + bool status = 2; +} + +service GoCryptoTrader { + rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) { + option (google.api.http) = { + get :"/v1/getinfo" + }; + } + + rpc GetSubsystems (GetSubsystemsRequest) returns (GetSusbsytemsResponse) { + option (google.api.http) = { + get: "/v1/getsubsystems" + }; + } + + rpc EnableSubsystem (GenericSubsystemRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/enablesubsystem" + }; + } + + rpc DisableSubsystem (GenericSubsystemRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/disablesubsystem" + }; + } + + rpc GetRPCEndpoints (GetRPCEndpointsRequest) returns (GetRPCEndpointsResponse) { + option (google.api.http) = { + get: "/v1/getrpcendpoints" + }; + } + + rpc GetCommunicationRelayers (GetCommunicationRelayersRequest) returns (GetCommunicationRelayersResponse) { + option (google.api.http) = { + get: "/v1/getcommunicationrelayers" + }; + } + + rpc GetExchanges (GetExchangesRequest) returns (GetExchangesResponse) { + option (google.api.http) = { + get: "/v1/getexchanges" + }; + } + + rpc DisableExchange (GenericExchangeNameRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/disableexchange" + body: "*" + }; + } + + rpc GetExchangeInfo (GenericExchangeNameRequest) returns (GetExchangeInfoResponse) { + option (google.api.http) = { + get: "/v1/getexchangeinfo" + }; + } + + rpc GetExchangeOTPCode (GenericExchangeNameRequest) returns (GetExchangeOTPReponse) { + option (google.api.http) = { + get: "/v1/getexchangeotp" + }; + } + + rpc GetExchangeOTPCodes (GetExchangeOTPsRequest) returns (GetExchangeOTPsResponse) { + option (google.api.http) = { + get: "/v1/getexchangeotps" + }; + } + + rpc EnableExchange (GenericExchangeNameRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/enableexchange" + body: "*" + }; + } + + rpc GetTicker (GetTickerRequest) returns (TickerResponse) { + option (google.api.http) = { + post: "/v1/getticker" + body: "*" + }; + } + + rpc GetTickers (GetTickersRequest) returns (GetTickersResponse) { + option (google.api.http) = { + get: "/v1/gettickers" + }; + } + + rpc GetOrderbook (GetOrderbookRequest) returns (OrderbookResponse) { + option (google.api.http) = { + post: "/v1/getorderbook" + body: "*" + }; + } + + rpc GetOrderbooks (GetOrderbooksRequest) returns (GetOrderbooksResponse) { + option (google.api.http) = { + get: "/v1/getorderbooks" + }; + } + + rpc GetAccountInfo (GetAccountInfoRequest) returns (GetAccountInfoResponse) { + option (google.api.http) = { + get: "/v1/getaccountinfo" + }; + } + + rpc UpdateAccountInfo (GetAccountInfoRequest) returns (GetAccountInfoResponse) { + option (google.api.http) = { + get: "/v1/updateaccountinfo" + }; + } + + rpc GetAccountInfoStream (GetAccountInfoRequest) returns (stream GetAccountInfoResponse) { + option (google.api.http) = { + get: "/v1/getaccountinfostream" + }; + } + + rpc GetConfig (GetConfigRequest) returns (GetConfigResponse) { + option (google.api.http) = { + get: "/v1/getconfig" + }; + } + + rpc GetPortfolio (GetPortfolioRequest) returns (GetPortfolioResponse) { + option (google.api.http) = { + get: "/v1/getportfolio" + }; + } + + rpc GetPortfolioSummary (GetPortfolioSummaryRequest) returns (GetPortfolioSummaryResponse) { + option (google.api.http) = { + get: "/v1/getportfoliosummary" + }; + } + + + rpc AddPortfolioAddress (AddPortfolioAddressRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/addportfolioaddress" + body: "*" + }; + } + + rpc RemovePortfolioAddress (RemovePortfolioAddressRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/removeportfolioaddress" + body: "*" + }; + } + + rpc GetForexProviders (GetForexProvidersRequest) returns (GetForexProvidersResponse) { + option (google.api.http) = { + get: "/v1/getforexproviders" + }; + } + + rpc GetForexRates (GetForexRatesRequest) returns (GetForexRatesResponse) { + option (google.api.http) = { + get: "/v1/getforexrates" + }; + } + + rpc GetOrders (GetOrdersRequest) returns (GetOrdersResponse) { + option (google.api.http) = { + post: "/v1/getorders" + body: "*" + }; + } + + rpc GetOrder (GetOrderRequest) returns (OrderDetails) { + option (google.api.http) = { + post: "/v1/getorder" + body: "*" + }; + } + + rpc SubmitOrder (SubmitOrderRequest) returns (SubmitOrderResponse) { + option (google.api.http) = { + post: "/v1/submitorder" + body: "*" + }; + } + + rpc SimulateOrder (SimulateOrderRequest) returns (SimulateOrderResponse) { + option (google.api.http) = { + post: "/v1/simulateorder" + body: "*" + }; + } + + rpc WhaleBomb (WhaleBombRequest) returns (SimulateOrderResponse) { + option (google.api.http) = { + post: "/v1/whalebomb" + body: "*" + }; + } + + rpc CancelOrder (CancelOrderRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/cancelorder" + body: "*" + }; + } + + rpc CancelBatchOrders (CancelBatchOrdersRequest) returns (CancelBatchOrdersResponse) { + option (google.api.http) = { + post: "/v1/cancelbatchorders" + body: "*" + }; + } + + rpc CancelAllOrders (CancelAllOrdersRequest) returns (CancelAllOrdersResponse) { + option (google.api.http) = { + post: "/v1/cancelallorders" + body: "*" + }; + } + + rpc GetEvents(GetEventsRequest) returns (GetEventsResponse) { + option (google.api.http) = { + get: "/v1/getevents" + }; + } + + rpc AddEvent(AddEventRequest) returns (AddEventResponse) { + option (google.api.http) = { + post: "/v1/addevent" + body: "*" + }; + } + + rpc RemoveEvent(RemoveEventRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/removeevent" + body: "*" + }; + } + + rpc GetCryptocurrencyDepositAddresses(GetCryptocurrencyDepositAddressesRequest) returns (GetCryptocurrencyDepositAddressesResponse) { + option (google.api.http) = { + post: "/v1/getcryptodepositaddresses" + body: "*" + }; + } + + rpc GetCryptocurrencyDepositAddress(GetCryptocurrencyDepositAddressRequest) returns (GetCryptocurrencyDepositAddressResponse) { + option (google.api.http) = { + post: "/v1/getcryptodepositaddress" + body: "*" + }; + } + + + rpc WithdrawFiatFunds(WithdrawFiatRequest) returns (WithdrawResponse) { + option (google.api.http) = { + post: "/v1/withdrawfiatfunds" + body: "*" + }; + } + + rpc WithdrawCryptocurrencyFunds(WithdrawCryptoRequest) returns (WithdrawResponse) { + option (google.api.http) = { + post: "/v1/withdrawithdrawcryptofundswfiatfunds" + body: "*" + }; + } + + rpc WithdrawalEventByID(WithdrawalEventByIDRequest) returns (WithdrawalEventByIDResponse) { + option (google.api.http) = { + post: "/v1/withdrawaleventbyid" + body: "*" + }; + } + + rpc WithdrawalEventsByExchange(WithdrawalEventsByExchangeRequest) returns (WithdrawalEventsByExchangeResponse) { + option (google.api.http) = { + post: "/v1/withdrawaleventbyid" + body: "*" + }; + } + + rpc WithdrawalEventsByDate(WithdrawalEventsByDateRequest) returns (WithdrawalEventsByExchangeResponse) { + option (google.api.http) = { + post: "/v1/withdrawaleventbydate" + body: "*" + }; + } + + rpc GetLoggerDetails(GetLoggerDetailsRequest) returns (GetLoggerDetailsResponse) { + option (google.api.http) = { + get: "/v1/getloggerdetails" + }; + } + + rpc SetLoggerDetails(SetLoggerDetailsRequest) returns (GetLoggerDetailsResponse) { + option (google.api.http) = { + post: "/v1/setloggerdetails", + body: "*" + }; + } + + rpc GetExchangePairs(GetExchangePairsRequest) returns (GetExchangePairsResponse) { + option (google.api.http) = { + post: "/v1/getexchangepairs", + body: "*" + }; + } + + rpc SetExchangePair(SetExchangePairRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/setexchangepair", + body: "*" + }; + } + + rpc GetOrderbookStream(GetOrderbookStreamRequest) returns (stream OrderbookResponse) { + option (google.api.http) = { + get: "/v1/getorderbookstream" + }; + } + + rpc GetExchangeOrderbookStream(GetExchangeOrderbookStreamRequest) returns (stream OrderbookResponse) { + option (google.api.http) = { + get: "/v1/getexchangeorderbookstream" + }; + } + + rpc GetTickerStream(GetTickerStreamRequest) returns (stream TickerResponse) { + option (google.api.http) = { + get: "/v1/gettickerstream" + }; + } + + rpc GetExchangeTickerStream(GetExchangeTickerStreamRequest) returns (stream TickerResponse) { + option (google.api.http) = { + get: "/v1/getexchangetickerstream", + }; + } + + rpc GetAuditEvent(GetAuditEventRequest) returns (GetAuditEventResponse) { + option (google.api.http) = { + get: "/v1/getauditevent", + }; + } + + rpc GCTScriptExecute(GCTScriptExecuteRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/gctscript/execute", + }; + } + + rpc GCTScriptUpload(GCTScriptUploadRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/gctscript/upload", + body: "*" + }; + } + + rpc GCTScriptReadScript(GCTScriptReadScriptRequest) returns (GCTScriptQueryResponse) { + option (google.api.http) = { + post: "/v1/gctscript/read", + body: "*" + }; + } + + rpc GCTScriptStatus(GCTScriptStatusRequest) returns (GCTScriptStatusResponse) { + option (google.api.http) = { + get: "/v1/gctscript/status", + }; + } + + rpc GCTScriptQuery(GCTScriptQueryRequest) returns (GCTScriptQueryResponse) { + option (google.api.http) = { + get: "/v1/gctscript/query", + }; + } + + rpc GCTScriptStop(GCTScriptStopRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/gctscript/stop", + body: "*" + }; + } + + rpc GCTScriptStopAll(GCTScriptStopAllRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/gctscript/stop", + body: "*" + }; + } + + rpc GCTScriptListAll(GCTScriptListAllRequest) returns (GCTScriptStatusResponse) { + option (google.api.http) = { + post: "/v1/gctscript/stop", + body: "*" + }; + } + rpc GCTScriptAutoLoadToggle(GCTScriptAutoLoadRequest) returns (GenericResponse) { + option (google.api.http) = { + post: "/v1/gctscript/autoload", + body: "*" + }; + } + + rpc GetHistoricCandles(GetHistoricCandlesRequest) returns (GetHistoricCandlesResponse) { + option (google.api.http) = { + get: "/v1/gethistoriccandles" + }; + } + + rpc SetExchangeAsset(SetExchangeAssetRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/setexchangeasset" + }; + } + + rpc SetAllExchangePairs(SetExchangeAllPairsRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/setallexchangepairs" + }; + } + + rpc UpdateExchangeSupportedPairs(UpdateExchangeSupportedPairsRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/updateexchangesupportedpairs" + }; + } + + rpc GetExchangeAssets(GetExchangeAssetsRequest) returns (GetExchangeAssetsResponse) { + option (google.api.http) = { + get: "/v1/getexchangeassets" + }; + } + + rpc WebsocketGetInfo(WebsocketGetInfoRequest) returns (WebsocketGetInfoResponse) { + option (google.api.http) = { + get: "/v1/websocketgetinfo" + }; + } + + rpc WebsocketSetEnabled(WebsocketSetEnabledRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/websocketsetenabled" + }; + } + + rpc WebsocketGetSubscriptions(WebsocketGetSubscriptionsRequest) returns (WebsocketGetSubscriptionsResponse) { + option (google.api.http) = { + get: "/v1/websocketgetsubscriptions" + }; + } + + rpc WebsocketSetProxy(WebsocketSetProxyRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/websocketsetproxy" + }; + } + + rpc WebsocketSetURL(WebsocketSetURLRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/websocketseturl" + }; + } + + rpc GetRecentTrades(GetSavedTradesRequest) returns (SavedTradesResponse) { + option (google.api.http) = { + get: "/v1/getsavedtrades" + }; + } + + rpc GetHistoricTrades(GetSavedTradesRequest) returns (stream SavedTradesResponse) { + option (google.api.http) = { + get: "/v1/getsavedtrades" + }; + } + + rpc GetSavedTrades(GetSavedTradesRequest) returns (SavedTradesResponse) { + option (google.api.http) = { + get: "/v1/getsavedtrades" + }; + } + + rpc ConvertTradesToCandles (ConvertTradesToCandlesRequest) returns (GetHistoricCandlesResponse) { + option (google.api.http) = { + get: "/v1/converttradestocandles" + }; + } + + rpc FindMissingSavedCandleIntervals (FindMissingCandlePeriodsRequest) returns (FindMissingIntervalsResponse) { + option (google.api.http) = { + get: "/v1/findmissingsavedcandleintervals" + }; + } + + rpc FindMissingSavedTradeIntervals (FindMissingTradePeriodsRequest) returns (FindMissingIntervalsResponse) { + option (google.api.http) = { + get: "/v1/findmissingsavedtradeintervals" + }; + } + + rpc SetExchangeTradeProcessing (SetExchangeTradeProcessingRequest) returns (GenericResponse) { + option (google.api.http) = { + get: "/v1/setexchangetradeprocessing" + }; + } } \ No newline at end of file diff --git a/gctscript/vm/manager.go b/gctscript/vm/manager.go index e670daf4..eda7851f 100644 --- a/gctscript/vm/manager.go +++ b/gctscript/vm/manager.go @@ -68,11 +68,7 @@ func (g *GctScriptManager) Stop() error { log.Debugln(log.GCTScriptMgr, gctscriptManagerName, subsystem.MsgSubSystemShuttingDown) close(g.shutdown) - err := g.ShutdownAll() - if err != nil { - return err - } - return nil + return g.ShutdownAll() } func (g *GctScriptManager) run(wg *sync.WaitGroup) { diff --git a/gctscript/wrappers/gct/exchange/exchange.go b/gctscript/wrappers/gct/exchange/exchange.go index b3facaa5..a7e00acf 100644 --- a/gctscript/wrappers/gct/exchange/exchange.go +++ b/gctscript/wrappers/gct/exchange/exchange.go @@ -182,7 +182,7 @@ func (e Exchange) WithdrawalFiatFunds(bankAccountID string, request *withdraw.Re request.Fiat.Bank.SWIFTCode = v.SWIFTCode request.Fiat.Bank.IBAN = v.IBAN - resp, err := engine.SubmitWithdrawal(request) + resp, err := engine.Bot.SubmitWithdrawal(request) if err != nil { return "", err } @@ -205,7 +205,7 @@ func (e Exchange) WithdrawalCryptoFunds(request *withdraw.Request) (string, erro request.OneTimePassword = v } - resp, err := engine.SubmitWithdrawal(request) + resp, err := engine.Bot.SubmitWithdrawal(request) if err != nil { return "", err } diff --git a/gctscript/wrappers/gct/gctwrapper_test.go b/gctscript/wrappers/gct/gctwrapper_test.go index 81392846..966b8c6c 100644 --- a/gctscript/wrappers/gct/gctwrapper_test.go +++ b/gctscript/wrappers/gct/gctwrapper_test.go @@ -33,6 +33,11 @@ func TestMain(m *testing.M) { engine.Bot.LoadExchange(exch.Value, false, nil) engine.Bot.DepositAddressManager = new(engine.DepositAddressManager) go engine.Bot.DepositAddressManager.Sync() + err = engine.Bot.OrderManager.Start(engine.Bot) + if err != nil { + log.Print(err) + os.Exit(1) + } modules.SetModuleWrapper(Setup()) os.Exit(m.Run()) } diff --git a/log/logger.go b/log/logger.go index 72dbd562..66ffaa95 100644 --- a/log/logger.go +++ b/log/logger.go @@ -50,11 +50,7 @@ func (l *Logger) newLogEvent(data, header, slName string, w io.Writer) error { // CloseLogger is called on shutdown of application func CloseLogger() error { - err := GlobalLogFile.Close() - if err != nil { - return err - } - return nil + return GlobalLogFile.Close() } func validSubLogger(s string) (bool, *subLogger) { diff --git a/log/logger_setup.go b/log/logger_setup.go index 6ab7d72f..96b3dab1 100644 --- a/log/logger_setup.go +++ b/log/logger_setup.go @@ -139,6 +139,7 @@ func init() { Global = registerNewSubLogger("LOG") ConnectionMgr = registerNewSubLogger("CONNECTION") + BackTester = registerNewSubLogger("BACKTESTER") CommunicationMgr = registerNewSubLogger("COMMS") ConfigMgr = registerNewSubLogger("CONFIG") DatabaseMgr = registerNewSubLogger("DATABASE") diff --git a/log/loggers.go b/log/loggers.go index 59023395..fcb356d1 100644 --- a/log/loggers.go +++ b/log/loggers.go @@ -7,157 +7,125 @@ import ( // Info takes a pointer subLogger struct and string sends to newLogEvent func Info(sl *subLogger, data string) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.info { return } - if !sl.Info { - return - } - - displayError(logger.newLogEvent(data, logger.InfoHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(data, fields.logger.InfoHeader, fields.name, fields.output)) } // Infoln takes a pointer subLogger struct and interface sends to newLogEvent func Infoln(sl *subLogger, v ...interface{}) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.info { return } - if !sl.Info { - return - } - - displayError(logger.newLogEvent(fmt.Sprintln(v...), logger.InfoHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(fmt.Sprintln(v...), fields.logger.InfoHeader, fields.name, fields.output)) } // Infof takes a pointer subLogger struct, string & interface formats and sends to Info() func Infof(sl *subLogger, data string, v ...interface{}) { - if sl == nil || !enabled() { - return - } - - if !sl.Info { - return - } - Info(sl, fmt.Sprintf(data, v...)) } // Debug takes a pointer subLogger struct and string sends to multiwriter func Debug(sl *subLogger, data string) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.debug { return } - if !sl.Debug { - return - } - - displayError(logger.newLogEvent(data, logger.DebugHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(data, fields.logger.DebugHeader, fields.name, fields.output)) } // Debugln takes a pointer subLogger struct, string and interface sends to newLogEvent func Debugln(sl *subLogger, v ...interface{}) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.debug { return } - if !sl.Debug { - return - } - - displayError(logger.newLogEvent(fmt.Sprintln(v...), logger.DebugHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(fmt.Sprintln(v...), fields.logger.DebugHeader, fields.name, fields.output)) } // Debugf takes a pointer subLogger struct, string & interface formats and sends to Info() func Debugf(sl *subLogger, data string, v ...interface{}) { - if sl == nil || !enabled() { - return - } - - if !sl.Debug { - return - } - Debug(sl, fmt.Sprintf(data, v...)) } // Warn takes a pointer subLogger struct & string and sends to newLogEvent() func Warn(sl *subLogger, data string) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.warn { return } - if !sl.Warn { - return - } - - displayError(logger.newLogEvent(data, logger.WarnHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(data, fields.logger.WarnHeader, fields.name, fields.output)) } // Warnln takes a pointer subLogger struct & interface formats and sends to newLogEvent() func Warnln(sl *subLogger, v ...interface{}) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.warn { return } - if !sl.Warn { - return - } - - displayError(logger.newLogEvent(fmt.Sprintln(v...), logger.WarnHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(fmt.Sprintln(v...), fields.logger.WarnHeader, fields.name, fields.output)) } // Warnf takes a pointer subLogger struct, string & interface formats and sends to Warn() func Warnf(sl *subLogger, data string, v ...interface{}) { - if sl == nil || !enabled() { - return - } - - if !sl.Warn { - return - } - Warn(sl, fmt.Sprintf(data, v...)) } // Error takes a pointer subLogger struct & interface formats and sends to newLogEvent() func Error(sl *subLogger, data ...interface{}) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.error { return } - if !sl.Error { - return - } - - displayError(logger.newLogEvent(fmt.Sprint(data...), logger.ErrorHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(fmt.Sprint(data...), fields.logger.ErrorHeader, fields.name, fields.output)) } // Errorln takes a pointer subLogger struct, string & interface formats and sends to newLogEvent() func Errorln(sl *subLogger, v ...interface{}) { - if sl == nil || !enabled() { + fields := getFields(sl) + if fields == nil { + return + } + if !fields.error { return } - if !sl.Error { - return - } - - displayError(logger.newLogEvent(fmt.Sprintln(v...), logger.ErrorHeader, sl.name, sl.output)) + displayError(fields.logger.newLogEvent(fmt.Sprintln(v...), fields.logger.ErrorHeader, fields.name, fields.output)) } // Errorf takes a pointer subLogger struct, string & interface formats and sends to Debug() func Errorf(sl *subLogger, data string, v ...interface{}) { - if sl == nil || !enabled() { - return - } - - if !sl.Error { - return - } - Error(sl, fmt.Sprintf(data, v...)) } @@ -178,3 +146,23 @@ func enabled() bool { } return false } + +func getFields(sl *subLogger) *logFields { + if !enabled() { + return nil + } + if sl == nil { + return nil + } + RWM.RLock() + defer RWM.RUnlock() + return &logFields{ + info: sl.Info, + warn: sl.Warn, + debug: sl.Debug, + error: sl.Error, + name: sl.name, + output: sl.output, + logger: *logger, + } +} diff --git a/log/sublogger_types.go b/log/sublogger_types.go index ec467f4b..67c9a502 100644 --- a/log/sublogger_types.go +++ b/log/sublogger_types.go @@ -1,10 +1,13 @@ package log +import "io" + // Global vars related to the logger package var ( subLoggers = map[string]*subLogger{} Global *subLogger + BackTester *subLogger ConnectionMgr *subLogger CommunicationMgr *subLogger ConfigMgr *subLogger @@ -27,3 +30,15 @@ var ( OrderBook *subLogger Trade *subLogger ) + +// logFields is used to store data in a non-global and thread-safe manner +// so logs cannot be modified mid-log causing a data-race issue +type logFields struct { + info bool + warn bool + debug bool + error bool + name string + output io.Writer + logger Logger +} diff --git a/main.go b/main.go index 2928838e..7cc203f5 100644 --- a/main.go +++ b/main.go @@ -125,6 +125,7 @@ func main() { if engine.Bot == nil || err != nil { log.Fatalf("Unable to initialise bot engine. Error: %s\n", err) } + config.Cfg = *engine.Bot.Config gctscript.Setup() diff --git a/testdata/binance_BTCUSDT_24h-trades_2020_11_16.csv b/testdata/binance_BTCUSDT_24h-trades_2020_11_16.csv new file mode 100644 index 00000000..b95a4480 --- /dev/null +++ b/testdata/binance_BTCUSDT_24h-trades_2020_11_16.csv @@ -0,0 +1,1000 @@ +1605499846,15993.5,0.026472,ANY +1605499846,15994.96,0.227,ANY +1605499846,15994.51,0.07,ANY +1605499846,15994.5,0.006957,ANY +1605499846,15994.18,0.012845,ANY +1605499846,15994,0.0375,ANY +1605499846,15994.97,0.0069,ANY +1605499847,15993.21,0.0069,ANY +1605499847,15992.98,0.014742,ANY +1605499847,15992.97,0.336319,ANY +1605499847,15992.98,0.003479,ANY +1605499847,15992.98,0.01373,ANY +1605499847,15992.98,0.012689,ANY +1605499847,15992.97,0.000736,ANY +1605499848,15992.97,0.162945,ANY +1605499848,15992.97,0.0069,ANY +1605499848,15992.7,0.07984,ANY +1605499848,15992.71,0.067413,ANY +1605499849,15992.71,0.001562,ANY +1605499849,15992.7,0.1,ANY +1605499849,15992.7,0.031264,ANY +1605499849,15992.71,0.011888,ANY +1605499849,15992.71,0.0022,ANY +1605499849,15992.71,0.003183,ANY +1605499850,15992.71,0.003627,ANY +1605499850,15992.71,0.010606,ANY +1605499850,15992.71,0.0088,ANY +1605499850,15992.71,0.001821,ANY +1605499851,15992.71,0.059331,ANY +1605499851,15992.71,0.0531,ANY +1605499851,15992.71,0.00167,ANY +1605499851,15992.71,0.00167,ANY +1605499851,15992.71,0.045888,ANY +1605499851,15992.71,0.002,ANY +1605499851,15992.71,0.002437,ANY +1605499851,15992.71,0.001666,ANY +1605499851,15992.71,0.002,ANY +1605499851,15992.71,0.002,ANY +1605499851,15992.85,0.003332,ANY +1605499851,15992.73,0.001666,ANY +1605499851,15992.75,0.001666,ANY +1605499851,15992.85,0.003568,ANY +1605499851,15992.91,0.019788,ANY +1605499851,15992.91,0.003336,ANY +1605499851,15992.98,0.001799,ANY +1605499851,15992.98,0.001765,ANY +1605499851,15992.98,0.00762,ANY +1605499851,15993.1,0.000989,ANY +1605499851,15992.98,0.054881,ANY +1605499851,15993.1,0.00591,ANY +1605499851,15993.1,1e-06,ANY +1605499851,15993.18,0.006899,ANY +1605499851,15994.25,0.0069,ANY +1605499851,15993.18,0.000725,ANY +1605499851,15993.5,0.018369,ANY +1605499851,15994.97,0.01,ANY +1605499851,15994.98,1.839006,ANY +1605499851,15994.98,0.12658,ANY +1605499851,15994.98,0.034414,ANY +1605499851,15994.98,0.001585,ANY +1605499851,15995,0.001501,ANY +1605499851,15995,0.03475,ANY +1605499851,15995,0.001249,ANY +1605499851,15995.21,0.005651,ANY +1605499851,15995.21,0.03127,ANY +1605499851,15995.21,0.033079,ANY +1605499851,15995.22,0.004421,ANY +1605499851,15995.22,0.002479,ANY +1605499851,15995.32,0.004421,ANY +1605499851,15995.32,0.03033,ANY +1605499851,15995.5,0.00717,ANY +1605499851,15995.16,0.01723,ANY +1605499851,15995.16,0.017556,ANY +1605499851,15995.85,0.0069,ANY +1605499851,15996.24,0.005109,ANY +1605499851,15996.24,0.006061,ANY +1605499851,15996.24,0.001874,ANY +1605499851,15995.85,0.087789,ANY +1605499851,15995.99,0.024761,ANY +1605499851,15995.99,0.0069,ANY +1605499851,15995.99,0.003125,ANY +1605499851,15996.24,0.003775,ANY +1605499851,15996.24,0.000412,ANY +1605499851,15996.8,0.0375,ANY +1605499851,15996.79,0.399,ANY +1605499851,15996.79,0.001,ANY +1605499851,15996.79,0.004439,ANY +1605499851,15996.79,0.001845,ANY +1605499851,15996.79,0.002931,ANY +1605499852,15996,0.073885,ANY +1605499852,15996,0.005641,ANY +1605499852,15996.01,0.0075,ANY +1605499852,15996,0.01457,ANY +1605499853,15996.01,0.012106,ANY +1605499853,15996,0.002685,ANY +1605499854,15996,0.002852,ANY +1605499854,15996,0.031257,ANY +1605499855,15996,0.002464,ANY +1605499855,15996,0.028307,ANY +1605499855,15996,0.002,ANY +1605499855,15996,0.034633,ANY +1605499855,15996,0.049351,ANY +1605499855,15996,0.010002,ANY +1605499855,15995.53,0.002959,ANY +1605499855,15995.54,0.001845,ANY +1605499855,15995.53,0.004299,ANY +1605499855,15995.21,0.016942,ANY +1605499855,15995,0.068831,ANY +1605499855,15993.98,0.01,ANY +1605499855,15993.97,0.299928,ANY +1605499855,15993.98,0.049352,ANY +1605499855,15993.98,0.00434,ANY +1605499856,15993.97,0.000726,ANY +1605499857,15993.97,0.006174,ANY +1605499857,15993.97,0.013536,ANY +1605499858,15993.97,0.002,ANY +1605499858,15993.18,0.00125,ANY +1605499858,15992.77,0.003599,ANY +1605499858,15992.78,0.046902,ANY +1605499858,15992.78,0.0074,ANY +1605499860,15993.37,0.011689,ANY +1605499860,15993.37,0.002987,ANY +1605499862,15993.37,0.005667,ANY +1605499863,15993.37,0.000695,ANY +1605499863,15993.37,0.0008,ANY +1605499863,15993.38,0.001729,ANY +1605499864,15993.37,0.000706,ANY +1605499865,15993.38,0.000688,ANY +1605499866,15993.37,0.00098,ANY +1605499866,15993.37,0.112825,ANY +1605499866,15993.37,0.000756,ANY +1605499866,15993.37,0.000762,ANY +1605499866,15993.37,0.00076,ANY +1605499866,15993.37,0.026799,ANY +1605499866,15993.37,0.000755,ANY +1605499866,15993.37,0.00082,ANY +1605499866,15993.37,0.000838,ANY +1605499866,15993.37,0.000756,ANY +1605499866,15993.37,0.000828,ANY +1605499866,15993.37,0.001727,ANY +1605499866,15993.37,0.002485,ANY +1605499866,15993.37,0.000759,ANY +1605499866,15993.37,0.000876,ANY +1605499866,15993.37,0.000769,ANY +1605499866,15993.37,0.001413,ANY +1605499866,15993.37,0.000804,ANY +1605499866,15993.37,0.00076,ANY +1605499866,15993.37,0.000763,ANY +1605499866,15993.37,0.001015,ANY +1605499866,15993.37,0.000995,ANY +1605499866,15993.37,0.001248,ANY +1605499866,15993.37,0.00076,ANY +1605499866,15993.37,0.000832,ANY +1605499866,15993.37,0.000745,ANY +1605499866,15993.37,0.000764,ANY +1605499866,15993.37,0.002374,ANY +1605499866,15993.37,0.001015,ANY +1605499866,15993.37,0.000756,ANY +1605499866,15993.37,0.000849,ANY +1605499866,15993.37,0.000778,ANY +1605499866,15993.37,0.000994,ANY +1605499866,15993.37,0.000775,ANY +1605499866,15993.37,0.000847,ANY +1605499866,15993.37,0.001122,ANY +1605499866,15993.37,7e-06,ANY +1605499866,15993.08,0.001214,ANY +1605499866,15993.08,0.009387,ANY +1605499866,15993.08,0.013613,ANY +1605499866,15993.08,0.019088,ANY +1605499866,15993.08,0.026912,ANY +1605499866,15993.08,0.000761,ANY +1605499866,15993.08,0.000753,ANY +1605499866,15993.08,0.000855,ANY +1605499866,15993.08,0.000843,ANY +1605499866,15993.08,0.000871,ANY +1605499866,15993.08,0.000756,ANY +1605499866,15993.07,0.029,ANY +1605499866,15993.07,0.015926,ANY +1605499866,15993.07,0.0069,ANY +1605499866,15993.08,0.000755,ANY +1605499866,15993.08,0.0011,ANY +1605499867,15993.08,0.000756,ANY +1605499867,15993.08,0.001808,ANY +1605499867,15993.08,0.000752,ANY +1605499867,15993.08,0.001165,ANY +1605499867,15993.08,0.000827,ANY +1605499867,15993.08,0.000983,ANY +1605499867,15993.08,0.002121,ANY +1605499867,15993.08,0.00079,ANY +1605499867,15993.08,0.000756,ANY +1605499867,15993.08,0.000855,ANY +1605499867,15993.08,0.000836,ANY +1605499867,15993.08,0.000869,ANY +1605499868,15993.08,0.000996,ANY +1605499868,15993.08,0.000921,ANY +1605499868,15993.08,0.001324,ANY +1605499868,15993.08,0.001111,ANY +1605499868,15993.08,0.000871,ANY +1605499868,15993.08,0.001223,ANY +1605499868,15993.08,0.000756,ANY +1605499868,15993.08,0.00077,ANY +1605499868,15993.08,0.00085,ANY +1605499868,15993.08,0.000986,ANY +1605499868,15993.08,0.001179,ANY +1605499869,15993.08,0.000761,ANY +1605499869,15993.08,0.000753,ANY +1605499869,15993.08,0.001148,ANY +1605499869,15993.08,0.000771,ANY +1605499869,15993.08,0.000756,ANY +1605499869,15993.08,0.001246,ANY +1605499869,15993.08,0.000773,ANY +1605499870,15993.08,0.000994,ANY +1605499870,15993.08,0.000774,ANY +1605499870,15993.08,0.0378,ANY +1605499870,15993.08,0.000763,ANY +1605499870,15993.08,0.000772,ANY +1605499870,15993.08,0.00134,ANY +1605499870,15993.08,0.000816,ANY +1605499870,15993.08,0.000753,ANY +1605499870,15993.08,0.00099,ANY +1605499870,15993.08,0.000882,ANY +1605499870,15993.08,0.001264,ANY +1605499871,15993.08,0.001805,ANY +1605499871,15993.08,0.000769,ANY +1605499871,15993.08,0.000825,ANY +1605499871,15993.08,0.003748,ANY +1605499872,15993.08,0.001768,ANY +1605499872,15993.07,0.000745,ANY +1605499874,15993.08,0.14039,ANY +1605499875,15993.07,0.002919,ANY +1605499877,15993.08,0.001643,ANY +1605499878,15993.08,0.00343,ANY +1605499879,15992.7,0.035325,ANY +1605499879,15993.06,0.029,ANY +1605499879,15992.77,0.003301,ANY +1605499879,15993.07,0.085525,ANY +1605499879,15992.77,0.0069,ANY +1605499879,15992.71,0.003458,ANY +1605499880,15992.7,0.000697,ANY +1605499881,15992.7,0.031259,ANY +1605499882,15992.71,0.000819,ANY +1605499882,15992.7,0.051037,ANY +1605499882,15992.7,0.036101,ANY +1605499882,15992.7,0.00722,ANY +1605499882,15992.7,0.021661,ANY +1605499882,15992.7,0.040447,ANY +1605499882,15992.7,0.028881,ANY +1605499883,15992.7,0.021661,ANY +1605499883,15992.7,0.225711,ANY +1605499883,15992.7,0.0069,ANY +1605499883,15992.7,0.006899,ANY +1605499883,15992.7,1e-06,ANY +1605499883,15992.51,0.002,ANY +1605499883,15992.51,0.002,ANY +1605499883,15992.51,0.002,ANY +1605499883,15992.51,0.006989,ANY +1605499883,15992.51,2e-06,ANY +1605499883,15990.65,0.006818,ANY +1605499883,15990.64,0.028607,ANY +1605499883,15990.65,0.008754,ANY +1605499884,15990.65,0.009063,ANY +1605499884,15990.65,0.001918,ANY +1605499884,15990.64,0.001823,ANY +1605499884,15990.64,0.001427,ANY +1605499885,15990.64,0.00365,ANY +1605499885,15990.64,0.001342,ANY +1605499887,15990.56,0.004066,ANY +1605499888,15990.56,0.004,ANY +1605499888,15990.56,0.000719,ANY +1605499888,15990.55,0.000739,ANY +1605499892,15990.55,0.006162,ANY +1605499892,15990.56,0.000769,ANY +1605499893,15990.55,0.029453,ANY +1605499893,15990.55,0.063646,ANY +1605499893,15990.55,0.0069,ANY +1605499893,15990.55,0.273083,ANY +1605499893,15990.55,0.032489,ANY +1605499893,15990.55,0.086034,ANY +1605499894,15990.55,0.10839,ANY +1605499894,15990.55,4e-06,ANY +1605499894,15990.09,0.014687,ANY +1605499894,15990.08,0.002531,ANY +1605499894,15990.08,0.003559,ANY +1605499894,15990.08,0.00019,ANY +1605499894,15990.08,0.006708,ANY +1605499894,15990.08,2e-06,ANY +1605499894,15990.08,0.006398,ANY +1605499894,15990,0.01718,ANY +1605499894,15990,0.01282,ANY +1605499894,15989.5,0.5,ANY +1605499894,15989.22,0.0069,ANY +1605499894,15990,0.0069,ANY +1605499894,15989.76,0.017182,ANY +1605499894,15987,0.01,ANY +1605499894,15988.44,0.019216,ANY +1605499894,15987.5,0.0375,ANY +1605499894,15987.23,0.0069,ANY +1605499894,15987.12,0.6,ANY +1605499894,15987,0.0375,ANY +1605499894,15986.66,0.117884,ANY +1605499894,15988.44,0.05,ANY +1605499894,15986.34,0.050984,ANY +1605499894,15986.66,0.062116,ANY +1605499894,15986.51,0.15,ANY +1605499894,15986.66,0.0069,ANY +1605499894,15986.35,0.16166,ANY +1605499894,15986.35,0.283656,ANY +1605499894,15986.35,0.043089,ANY +1605499894,15986.35,0.1,ANY +1605499895,15986.35,0.002,ANY +1605499895,15986.35,0.000655,ANY +1605499895,15988.4,0.01602,ANY +1605499895,15986.44,0.0069,ANY +1605499895,15988.39,0.039393,ANY +1605499895,15986.35,0.001345,ANY +1605499895,15987.38,0.006888,ANY +1605499895,15987.37,0.0069,ANY +1605499895,15987.37,0.008275,ANY +1605499895,15987.37,0.062505,ANY +1605499895,15987.37,0.12502,ANY +1605499896,15987.84,0.088353,ANY +1605499896,15987.84,0.0069,ANY +1605499896,15987.84,0.029557,ANY +1605499896,15987.84,0.014027,ANY +1605499896,15987.84,0.003316,ANY +1605499897,15987.62,0.00075,ANY +1605499897,15987.62,0.003316,ANY +1605499898,15987.62,0.002834,ANY +1605499898,15987.62,0.0069,ANY +1605499898,15987.62,0.009771,ANY +1605499898,15987.38,0.022151,ANY +1605499900,15987.37,0.04,ANY +1605499900,15987.37,0.005,ANY +1605499900,15987.37,0.001892,ANY +1605499901,15990.96,0.015798,ANY +1605499901,15987.38,0.006079,ANY +1605499901,15987.38,0.002419,ANY +1605499901,15987.38,0.002,ANY +1605499901,15987.38,0.024712,ANY +1605499901,15987.38,0.002,ANY +1605499901,15987.38,0.002,ANY +1605499901,15987.5,0.157569,ANY +1605499901,15987.51,0.0069,ANY +1605499901,15987.61,0.1,ANY +1605499901,15987.62,0.4384,ANY +1605499901,15987.63,0.004895,ANY +1605499901,15987.74,0.0069,ANY +1605499901,15987.85,0.006378,ANY +1605499901,15988.16,0.2,ANY +1605499901,15988.17,0.018019,ANY +1605499901,15988.37,0.00125,ANY +1605499901,15988.99,0.2,ANY +1605499901,15989,0.0375,ANY +1605499901,15987.38,0.075,ANY +1605499901,15989.21,0.112548,ANY +1605499901,15989.5,0.0375,ANY +1605499901,15989.98,0.01,ANY +1605499901,15989.99,0.08,ANY +1605499901,15990,0.0375,ANY +1605499901,15990.05,0.0069,ANY +1605499901,15990.08,0.018597,ANY +1605499901,15990.33,0.0069,ANY +1605499901,15990.45,0.264401,ANY +1605499901,15990.5,0.0375,ANY +1605499901,15990.56,0.002512,ANY +1605499901,15990.6,0.703972,ANY +1605499901,15990.61,0.0069,ANY +1605499901,15990.95,0.2,ANY +1605499901,15989.12,0.0069,ANY +1605499901,15990.98,0.193845,ANY +1605499901,15986.46,0.010184,ANY +1605499901,15986.92,0.0069,ANY +1605499901,15987.85,0.006317,ANY +1605499901,15988.17,0.013809,ANY +1605499901,15988.37,0.04,ANY +1605499901,15990.82,0.00385,ANY +1605499901,15990.96,0.000713,ANY +1605499901,15990.96,0.03198,ANY +1605499901,15990.96,0.006703,ANY +1605499902,15990.96,0.002,ANY +1605499902,15990.96,0.002,ANY +1605499902,15990.96,0.000474,ANY +1605499902,15990.96,0.065799,ANY +1605499902,15990.96,0.008098,ANY +1605499902,15990.96,0.019137,ANY +1605499902,15990.96,0.002194,ANY +1605499902,15990.97,0.000964,ANY +1605499902,15990.96,0.277864,ANY +1605499902,15990.97,0.000966,ANY +1605499903,15990.26,0.014737,ANY +1605499905,15990.26,0.000706,ANY +1605499906,15990.26,0.001686,ANY +1605499906,15990.26,0.469314,ANY +1605499907,15989.47,0.015554,ANY +1605499907,15990.26,0.04,ANY +1605499907,15989.98,0.002,ANY +1605499907,15989.79,0.009318,ANY +1605499907,15990.26,0.029,ANY +1605499907,15988.39,0.043037,ANY +1605499907,15988.46,0.0049,ANY +1605499909,15989.34,0.0069,ANY +1605499909,15989.34,0.0069,ANY +1605499909,15989.34,0.04,ANY +1605499909,15990.24,0.012351,ANY +1605499910,15990.17,0.00624,ANY +1605499910,15990.17,0.00066,ANY +1605499910,15990.17,0.0069,ANY +1605499910,15990.08,0.0712,ANY +1605499910,15989.77,0.000663,ANY +1605499910,15989.77,0.006237,ANY +1605499910,15988.34,0.04,ANY +1605499910,15989.77,0.006237,ANY +1605499910,15988.89,0.0069,ANY +1605499910,15988.39,0.0069,ANY +1605499910,15988.15,0.012507,ANY +1605499910,15988.13,0.326206,ANY +1605499910,15988.37,0.00125,ANY +1605499910,15988.14,0.001975,ANY +1605499911,15988.14,0.003226,ANY +1605499911,15988.51,0.000666,ANY +1605499911,15988.51,0.000667,ANY +1605499911,15988.51,0.000666,ANY +1605499911,15988.52,0.001931,ANY +1605499911,15988.52,0.004969,ANY +1605499911,15988.52,0.0069,ANY +1605499911,15990.13,0.011098,ANY +1605499912,15990.11,0.004228,ANY +1605499912,15990.11,0.01,ANY +1605499913,15990.11,0.00187,ANY +1605499913,15990.11,0.000934,ANY +1605499913,15990.11,0.000716,ANY +1605499916,15990.12,0.024334,ANY +1605499916,15990.12,0.0069,ANY +1605499916,15990.12,0.015666,ANY +1605499917,15990.13,0.004262,ANY +1605499917,15990.13,0.005757,ANY +1605499917,15990.14,0.003924,ANY +1605499918,15990.13,0.012615,ANY +1605499918,15990.13,0.014329,ANY +1605499918,15990.13,0.030571,ANY +1605499919,15990.13,0.010019,ANY +1605499920,15990.12,0.000807,ANY +1605499920,15990.12,0.00081,ANY +1605499920,15990.12,0.000753,ANY +1605499920,15990.12,0.000811,ANY +1605499920,15990.12,0.000811,ANY +1605499920,15990.12,0.000785,ANY +1605499921,15990.12,0.000777,ANY +1605499921,15990.12,0.00076,ANY +1605499921,15990.12,0.001805,ANY +1605499921,15990.12,0.00081,ANY +1605499921,15990.12,0.000811,ANY +1605499921,15990.11,0.000726,ANY +1605499922,15990.12,0.000794,ANY +1605499922,15990.11,0.010019,ANY +1605499922,15990.12,0.001727,ANY +1605499922,15990.12,0.002484,ANY +1605499922,15990.12,0.000807,ANY +1605499922,15990.12,0.000784,ANY +1605499922,15990.12,0.000809,ANY +1605499922,15990.12,0.001176,ANY +1605499922,15990.11,0.006664,ANY +1605499922,15990.12,0.000754,ANY +1605499922,15990.12,0.000756,ANY +1605499923,15990.12,0.00077,ANY +1605499923,15990.12,0.000811,ANY +1605499923,15990.12,0.000807,ANY +1605499923,15990.12,0.000811,ANY +1605499923,15990.12,0.000806,ANY +1605499924,15990.12,0.000777,ANY +1605499924,15990.12,0.000809,ANY +1605499924,15990.12,0.000809,ANY +1605499924,15990.12,0.00078,ANY +1605499924,15990.12,0.000759,ANY +1605499924,15990.12,0.000761,ANY +1605499924,15990.11,0.001291,ANY +1605499924,15990.12,0.002374,ANY +1605499924,15990.12,0.000804,ANY +1605499924,15990.12,0.000809,ANY +1605499925,15990.12,0.000809,ANY +1605499925,15990.11,0.004348,ANY +1605499925,15990.11,0.063308,ANY +1605499925,15990.12,0.000777,ANY +1605499925,15990.11,0.032245,ANY +1605499925,15990.12,0.000788,ANY +1605499925,15990.11,0.002295,ANY +1605499925,15990.12,0.000775,ANY +1605499926,15990.12,0.000751,ANY +1605499926,15990.12,0.001214,ANY +1605499926,15990.12,0.000775,ANY +1605499926,15990.12,0.000756,ANY +1605499926,15990.12,0.000469,ANY +1605499926,15990.12,0.002,ANY +1605499926,15990.12,0.006564,ANY +1605499926,15990.12,0.002,ANY +1605499926,15990.12,0.007972,ANY +1605499926,15990.12,0.000804,ANY +1605499927,15990.12,0.000763,ANY +1605499927,15990.12,0.002121,ANY +1605499927,15990.12,0.007945,ANY +1605499927,15990.12,0.025487,ANY +1605499927,15990.12,0.006565,ANY +1605499927,15990.59,0.009073,ANY +1605499927,15990.12,0.003689,ANY +1605499927,15990.14,0.002976,ANY +1605499927,15990.15,0.014139,ANY +1605499927,15990.22,0.0069,ANY +1605499927,15990.25,0.0069,ANY +1605499927,15990.12,2.5e-05,ANY +1605499927,15990.9,0.049895,ANY +1605499927,15990.91,0.008554,ANY +1605499928,15990.91,0.0069,ANY +1605499928,15990.91,0.002,ANY +1605499928,15990.91,0.002,ANY +1605499928,15991.38,0.004741,ANY +1605499928,15991.26,0.04,ANY +1605499928,15991.38,0.002451,ANY +1605499928,15991.38,0.0069,ANY +1605499928,15991.7,0.015175,ANY +1605499928,15992.48,0.15,ANY +1605499928,15992.62,0.0069,ANY +1605499928,15992.9,0.0069,ANY +1605499928,15992.9,0.0069,ANY +1605499928,15993.06,0.004453,ANY +1605499928,15993.06,0.026004,ANY +1605499928,15993.06,0.0074,ANY +1605499928,15993.06,0.016533,ANY +1605499929,15993.07,0.0062,ANY +1605499929,15993.07,0.004831,ANY +1605499929,15993.06,0.077685,ANY +1605499929,15993.06,0.09181,ANY +1605499929,15993.09,0.084336,ANY +1605499930,15993.09,0.00073,ANY +1605499932,15993.09,0.004995,ANY +1605499933,15993.09,0.040716,ANY +1605499933,15993.09,0.006692,ANY +1605499938,15993.09,0.000749,ANY +1605499938,15993.1,0.003889,ANY +1605499938,15993.09,0.00194,ANY +1605499938,15993.1,0.014386,ANY +1605499938,15993.09,0.00194,ANY +1605499938,15993.09,0.0032,ANY +1605499938,15993.1,0.000807,ANY +1605499938,15993.1,0.000767,ANY +1605499939,15993.1,0.000807,ANY +1605499939,15993.1,0.000772,ANY +1605499939,15993.1,0.000811,ANY +1605499940,15993.09,0.004853,ANY +1605499942,15993.1,0.050375,ANY +1605499942,15993.1,0.041338,ANY +1605499944,15993.09,0.000762,ANY +1605499944,15993.09,0.000756,ANY +1605499944,15993.09,0.000768,ANY +1605499944,15993.09,0.000811,ANY +1605499944,15993.09,0.000808,ANY +1605499944,15993.09,0.000766,ANY +1605499944,15993.09,0.039806,ANY +1605499944,15993.09,0.000807,ANY +1605499944,15993.09,0.001325,ANY +1605499944,15993.09,0.000775,ANY +1605499944,15993.09,0.000809,ANY +1605499944,15993.09,0.000807,ANY +1605499944,15993.09,0.00069,ANY +1605499944,15993.1,0.000789,ANY +1605499944,15993.1,0.49045,ANY +1605499945,15993.1,0.194809,ANY +1605499945,15993.1,0.0069,ANY +1605499945,15993.1,0.15,ANY +1605499945,15993.1,0.002221,ANY +1605499945,15993.1,0.001847,ANY +1605499945,15993.1,0.001846,ANY +1605499945,15993.1,0.001847,ANY +1605499945,15993.1,0.001847,ANY +1605499945,15993.1,0.002,ANY +1605499945,15993.1,0.002,ANY +1605499945,15993.1,0.002,ANY +1605499945,15993.1,0.003693,ANY +1605499945,15993.37,0.013544,ANY +1605499945,15993.38,0.004483,ANY +1605499945,15993.38,0.0069,ANY +1605499945,15993.4,0.625752,ANY +1605499945,15993.37,0.0069,ANY +1605499945,15993.57,0.00162,ANY +1605499945,15993.57,0.0069,ANY +1605499945,15993.9,0.703972,ANY +1605499945,15994.1,0.014257,ANY +1605499945,15994.17,0.002,ANY +1605499945,15994.76,0.0069,ANY +1605499945,15995.03,0.0069,ANY +1605499945,15996,0.006878,ANY +1605499946,15996,0.002,ANY +1605499946,15996.2,2.1e-05,ANY +1605499946,15996.2,0.001516,ANY +1605499947,15996.2,0.000463,ANY +1605499947,15996.2,0.0069,ANY +1605499947,15996.2,0.001985,ANY +1605499947,15996.2,1.5e-05,ANY +1605499947,15996.2,0.001978,ANY +1605499948,15996.2,2.2e-05,ANY +1605499948,15996.2,0.039979,ANY +1605499948,15996.2,2.1e-05,ANY +1605499948,15996.82,0.054143,ANY +1605499948,15996.82,0.161661,ANY +1605499948,15996.82,0.004984,ANY +1605499948,15996.82,0.161659,ANY +1605499948,15996.82,0.07172,ANY +1605499948,15996.82,0.542714,ANY +1605499948,15996.82,0.512167,ANY +1605499948,15996.82,0.09,ANY +1605499948,15996.82,0.002,ANY +1605499948,15996.19,0.003368,ANY +1605499949,15996.19,0.003532,ANY +1605499949,15996.19,0.029038,ANY +1605499950,15996.2,0.002,ANY +1605499950,15996.2,0.009233,ANY +1605499950,15996.2,0.015773,ANY +1605499952,15996.19,0.001806,ANY +1605499952,15996.19,0.000727,ANY +1605499955,15996.19,0.003273,ANY +1605499955,15996.19,0.002927,ANY +1605499956,15996.2,0.001846,ANY +1605499956,15996.2,0.001847,ANY +1605499956,15996.53,0.006898,ANY +1605499956,15996.2,0.003694,ANY +1605499956,15996.53,0.006874,ANY +1605499956,15996.53,2e-06,ANY +1605499956,15996.53,2.6e-05,ANY +1605499956,15996.82,0.003923,ANY +1605499956,15996.82,0.010848,ANY +1605499957,15996.82,0.015401,ANY +1605499957,15996.82,0.368828,ANY +1605499957,15996.82,0.149435,ANY +1605499957,15996.82,0.012224,ANY +1605499957,15996.82,0.017074,ANY +1605499957,15996.82,0.0037,ANY +1605499957,15996.82,0.00251,ANY +1605499958,15996.83,0.0069,ANY +1605499958,15996.83,0.0069,ANY +1605499958,15996.83,0.002,ANY +1605499958,15996.83,0.002,ANY +1605499958,15996.83,0.078034,ANY +1605499958,15996.82,0.095631,ANY +1605499958,15996.82,0.000916,ANY +1605499958,15996.82,0.04183,ANY +1605499958,15996.82,0.042374,ANY +1605499959,15996.82,0.001284,ANY +1605499959,15996.82,0.006657,ANY +1605499959,15996.82,0.01272,ANY +1605499960,15996.82,0.000753,ANY +1605499961,15996.82,1.1,ANY +1605499962,15996.82,0.00093,ANY +1605499962,15996.83,0.012215,ANY +1605499962,15996.82,1.817857,ANY +1605499962,15996.82,0.002,ANY +1605499962,15996.82,0.055143,ANY +1605499962,15996.82,0.032701,ANY +1605499962,15996.82,0.024933,ANY +1605499962,15996.82,0.006393,ANY +1605499962,15996.68,0.0069,ANY +1605499962,15996.63,0.002,ANY +1605499962,15996.63,0.002,ANY +1605499962,15996.36,0.0021,ANY +1605499962,15996.36,0.0048,ANY +1605499962,15996.35,0.0013,ANY +1605499962,15996.35,0.004802,ANY +1605499962,15996.2,0.000704,ANY +1605499962,15996.19,0.000494,ANY +1605499962,15996.09,0.0069,ANY +1605499962,15996.03,0.017566,ANY +1605499962,15996.19,0.000579,ANY +1605499963,15994.14,0.007154,ANY +1605499963,15996,0.002,ANY +1605499963,15996,0.002,ANY +1605499963,15996,0.002,ANY +1605499963,15995.8,0.002,ANY +1605499963,15995.61,0.0069,ANY +1605499963,15994.14,0.01,ANY +1605499963,15995.2,0.04,ANY +1605499963,15994.01,0.003735,ANY +1605499964,15994.01,0.038966,ANY +1605499964,15994.01,0.034911,ANY +1605499964,15994,0.000799,ANY +1605499964,15994.01,0.060565,ANY +1605499965,15994,0.001587,ANY +1605499966,15992,0.01,ANY +1605499966,15994,0.002,ANY +1605499966,15994,0.000802,ANY +1605499966,15993.23,0.0069,ANY +1605499966,15993.11,0.0243,ANY +1605499966,15993.1,0.062526,ANY +1605499966,15993.08,0.0069,ANY +1605499966,15992.9,0.002,ANY +1605499966,15992.9,0.002,ANY +1605499966,15992.9,0.002,ANY +1605499966,15992,0.0375,ANY +1605499966,15993.46,0.0069,ANY +1605499966,15991.54,0.026445,ANY +1605499966,15993.09,0.0037,ANY +1605499966,15993.09,0.0037,ANY +1605499966,15993.08,0.001893,ANY +1605499967,15993.08,0.06191,ANY +1605499967,15993.08,0.109629,ANY +1605499968,15993.08,0.002127,ANY +1605499969,15993.08,0.000695,ANY +1605499971,15993.09,0.02,ANY +1605499972,15993.08,0.007351,ANY +1605499973,15992.36,0.048148,ANY +1605499973,15992.36,0.006747,ANY +1605499973,15992.36,0.000153,ANY +1605499975,15991.57,0.000667,ANY +1605499976,15991.57,0.002,ANY +1605499976,15991.57,0.006233,ANY +1605499976,15991.55,0.00125,ANY +1605499976,15991.53,0.0069,ANY +1605499976,15991.57,0.04,ANY +1605499977,15991.14,0.00196,ANY +1605499977,15991.14,0.0069,ANY +1605499977,15991.14,0.00494,ANY +1605499977,15991.1,0.008551,ANY +1605499977,15991.1,0.000306,ANY +1605499977,15990.78,0.016174,ANY +1605499977,15990.71,0.002,ANY +1605499977,15990.78,0.000307,ANY +1605499977,15990.71,0.001693,ANY +1605499977,15989.69,0.037556,ANY +1605499977,15990.71,0.0069,ANY +1605499977,15990.35,0.0069,ANY +1605499977,15990.11,0.235893,ANY +1605499977,15990.11,0.143937,ANY +1605499977,15990.71,0.000307,ANY +1605499977,15989.92,0.002,ANY +1605499977,15989.92,0.002,ANY +1605499977,15989.92,0.002,ANY +1605499977,15990,0.012507,ANY +1605499977,15989.69,0.025931,ANY +1605499977,15989.32,0.006069,ANY +1605499977,15989.32,0.000831,ANY +1605499977,15989.12,0.031791,ANY +1605499977,15989.12,0.008209,ANY +1605499977,15988.32,0.0069,ANY +1605499977,15988.16,0.02261,ANY +1605499977,15988.16,0.029523,ANY +1605499977,15987.99,0.098843,ANY +1605499977,15988.11,0.027015,ANY +1605499977,15988.13,0.0069,ANY +1605499977,15987.8,0.18,ANY +1605499977,15987.79,0.000724,ANY +1605499977,15987.8,0.0037,ANY +1605499977,15987.79,0.002844,ANY +1605499977,15987.8,0.16839,ANY +1605499977,15987.79,0.37983,ANY +1605499977,15987.79,0.024678,ANY +1605499977,15987.79,0.468422,ANY +1605499977,15987.79,0.0069,ANY +1605499978,15987.79,0.118126,ANY +1605499978,15987.8,0.086163,ANY +1605499978,15988.62,0.012399,ANY +1605499978,15988.63,0.04722,ANY +1605499979,15988.62,0.002047,ANY +1605499980,15988.62,0.003786,ANY +1605499981,15988.62,0.000769,ANY +1605499981,15988.62,0.001067,ANY +1605499981,15988.62,0.000807,ANY +1605499981,15988.62,0.000872,ANY +1605499981,15988.62,0.000753,ANY +1605499981,15988.62,0.000872,ANY +1605499981,15988.62,0.001806,ANY +1605499981,15988.62,0.000868,ANY +1605499981,15988.62,0.000874,ANY +1605499981,15988.62,0.000619,ANY +1605499981,15988.62,0.000165,ANY +1605499981,15988.62,0.000981,ANY +1605499981,15988.39,0.000838,ANY +1605499982,15988.39,0.001727,ANY +1605499982,15988.39,0.002485,ANY +1605499982,15988.39,0.000872,ANY +1605499982,15988.39,0.001178,ANY +1605499982,15988.39,0.033019,ANY +1605499982,15988.39,0.1,ANY +1605499982,15988.39,0.002,ANY +1605499982,15988.39,0.000821,ANY +1605499982,15988.39,0.001179,ANY +1605499982,15988.51,0.0069,ANY +1605499982,15988.63,0.004185,ANY +1605499982,15988.62,0.009038,ANY +1605499982,15988.62,0.003495,ANY +1605499982,15988.62,0.003892,ANY +1605499982,15988.63,0.0069,ANY +1605499982,15988.74,0.0069,ANY +1605499982,15988.85,0.040158,ANY +1605499982,15988.85,0.004338,ANY +1605499982,15988.86,0.002562,ANY +1605499982,15988.63,0.001842,ANY +1605499982,15988.98,0.005169,ANY +1605499982,15988.86,0.005121,ANY +1605499982,15988.87,0.0069,ANY +1605499982,15988.98,0.107379,ANY +1605499982,15989.18,0.005081,ANY +1605499982,15989.18,0.012112,ANY +1605499982,15989.18,0.0069,ANY +1605499982,15990.42,0.0069,ANY +1605499982,15991.2,0.0069,ANY +1605499982,15991.13,0.0069,ANY +1605499982,15991.49,0.003475,ANY +1605499983,15991.57,0.003451,ANY +1605499983,15991.57,0.003752,ANY +1605499984,15991.58,0.117,ANY +1605499985,15991.57,0.000706,ANY +1605499985,15991.57,0.00172,ANY +1605499985,15991.58,0.000806,ANY +1605499985,15991.58,0.00087,ANY +1605499986,15991.58,0.001214,ANY +1605499986,15991.58,0.000856,ANY +1605499986,15991.57,0.016354,ANY +1605499986,15991.57,0.002848,ANY +1605499986,15991.58,0.000864,ANY +1605499986,15991.58,0.000755,ANY +1605499986,15991.57,0.010622,ANY +1605499986,15991.58,0.0011,ANY +1605499986,15991.58,0.00083,ANY +1605499986,15991.58,0.000874,ANY +1605499987,15991.57,0.010622,ANY +1605499987,15991.58,0.001165,ANY +1605499987,15991.58,0.000982,ANY +1605499987,15991.57,0.145565,ANY +1605499987,15991.57,0.075306,ANY +1605499987,15991.58,0.002121,ANY +1605499987,15991.57,0.001254,ANY +1605499987,15991.57,0.000816,ANY +1605499987,15991.57,0.000775,ANY +1605499987,15991.57,0.001125,ANY +1605499987,15991.57,0.000835,ANY +1605499987,15991.57,0.002374,ANY +1605499987,15991.57,0.001015,ANY +1605499987,15991.57,0.000874,ANY +1605499987,15991.57,0.000994,ANY +1605499987,15991.57,0.001249,ANY +1605499987,15991.58,0.000854,ANY +1605499987,15991.58,0.002944,ANY +1605499988,15991.58,0.000797,ANY +1605499988,15991.58,0.001324,ANY +1605499988,15991.58,0.000967,ANY +1605499988,15991.58,0.000798,ANY +1605499988,15991.58,0.001224,ANY +1605499988,15991.53,0.001266,ANY +1605499988,15991.55,0.001266,ANY +1605499988,15991.57,1.2e-05,ANY +1605499988,15991.08,0.009886,ANY +1605499988,15990.95,0.0069,ANY +1605499988,15990.5,0.019611,ANY +1605499988,15990.04,0.011158,ANY +1605499988,15990.68,0.00118,ANY +1605499989,15990.67,0.0069,ANY +1605499989,15990.67,0.023358,ANY +1605499989,15990.68,0.001247,ANY +1605499989,15990.68,0.000688,ANY +1605499990,15990.82,0.0069,ANY +1605499990,15991.57,0.01,ANY +1605499990,15991.58,0.7841,ANY +1605499990,15991.58,0.795,ANY +1605499990,15992.16,0.042085,ANY +1605499990,15991.58,0.282555,ANY +1605499990,15991.58,0.0069,ANY +1605499990,15992.37,0.056774,ANY +1605499990,15991.77,0.002,ANY +1605499990,15991.98,0.0069,ANY +1605499990,15992,0.00594,ANY +1605499990,15991.58,0.001846,ANY +1605499990,15992.37,0.795,ANY +1605499990,15992.37,0.399,ANY +1605499990,15992.37,0.0069,ANY +1605499990,15992.36,0.005986,ANY +1605499990,15992.57,0.04,ANY +1605499990,15992.73,0.0069,ANY +1605499990,15992.57,0.0069,ANY +1605499990,15993.08,0.077225,ANY +1605499990,15993.08,0.017821,ANY +1605499990,15993.08,0.091204,ANY +1605499993,15993.08,0.000693,ANY +1605499993,15993.09,0.002404,ANY +1605499993,15993.09,0.004496,ANY +1605499993,15993.09,0.002,ANY +1605499993,15993.09,0.002,ANY +1605499993,15993.09,0.027499,ANY +1605499993,15993.08,0.00069,ANY +1605499994,15993.08,0.081955,ANY +1605499994,15993.08,0.038198,ANY +1605499994,15993.08,0.004791,ANY +1605499997,15993.09,0.002699,ANY +1605499998,15993.09,0.009802,ANY +1605499998,15994,0.00125,ANY +1605499998,15994.01,0.002218,ANY +1605499998,15994.01,0.052688,ANY +1605499998,15994.01,0.028747,ANY +1605499998,15994.01,0.094217,ANY +1605499998,15994.04,0.032701,ANY +1605499998,15994.04,0.491947,ANY +1605499998,15994.04,0.014386,ANY +1605499998,15994.04,0.011758,ANY +1605499998,15994.04,0.485259,ANY +1605499998,15994.04,0.005555,ANY +1605499999,15994.04,0.109186,ANY +1605499999,15994.02,0.0069,ANY +1605499999,15994.02,0.529018,ANY +1605499999,15994.02,0.47432,ANY +1605499999,15994.02,0.307847,ANY +1605499999,15994.02,0.0277,ANY +1605499999,15994.02,0.020941,ANY +1605500001,15994.05,0.0069,ANY +1605500001,15994.2,0.001877,ANY +1605500001,15994.19,0.000739,ANY +1605500001,15994.2,0.000123,ANY +1605500001,15994.2,0.006887,ANY +1605500003,15994.2,0.000808,ANY +1605500003,15994.2,0.001192,ANY +1605500003,15994.2,0.000221,ANY +1605500003,15994.2,0.000856,ANY +1605500004,15994.2,0.001987,ANY +1605500004,15994.2,0.000923,ANY +1605500007,15996,0.01,ANY +1605500007,15994.2,1.3e-05,ANY +1605500007,15995.75,0.015008,ANY +1605500007,15996,0.0375,ANY +1605500007,15996.23,0.031376,ANY +1605500007,15996.45,0.140035,ANY +1605500007,15995.51,0.00992,ANY +1605500008,15995.32,0.539238,ANY +1605500008,15995.32,0.0069,ANY +1605500008,15995.32,0.021084,ANY +1605500008,15995.32,0.043916,ANY +1605500008,15994.78,0.0069,ANY +1605500008,15994.78,0.0069,ANY +1605500008,15994.19,0.000823,ANY +1605500010,15994.19,0.008042,ANY +1605500010,15994.19,0.000703,ANY +1605500010,15994.19,0.003125,ANY +1605500010,15994.19,0.021824,ANY +1605500010,15994.19,0.0069,ANY +1605500010,15994.19,0.003214,ANY +1605500010,15994.19,0.021825,ANY +1605500010,15994.19,0.013673,ANY +1605500010,15994,0.002,ANY +1605500010,15994.19,0.001288,ANY +1605500010,15994.19,0.002,ANY +1605500010,15994.12,0.0069,ANY +1605500010,15994,0.008143,ANY +1605500010,15994,0.002,ANY +1605500010,15994,0.002,ANY +1605500010,15992.91,0.001278,ANY +1605500010,15992.91,0.002945,ANY +1605500010,15992.91,0.01645,ANY +1605500011,15992.91,0.002407,ANY +1605500011,15992.9,0.000833,ANY +1605500012,15992.9,0.001079,ANY +1605500012,15992.9,0.0069,ANY +1605500012,15992.9,0.004988,ANY +1605500012,15992.9,0.00249,ANY +1605500013,15992.89,0.001277,ANY +1605500013,15992.89,0.000723,ANY +1605500013,15992.89,0.001998,ANY +1605500013,15992.89,2e-06,ANY +1605500013,15992.47,0.001197,ANY +1605500013,15992.46,0.006899,ANY +1605500013,15992.46,1e-06,ANY +1605500013,15992.09,0.001332,ANY +1605500014,15992.09,0.015,ANY +1605500014,15992.09,0.244311,ANY +1605500014,15992.09,0.023668,ANY +1605500014,15992.09,0.0069,ANY +1605500015,15992.09,0.032274,ANY +1605500016,15992.1,0.030411,ANY +1605500016,15992.09,0.000698,ANY +1605500016,15992.1,0.002842,ANY +1605500018,15992.09,0.001999,ANY +1605500020,15992.1,0.039976,ANY +1605500020,15992.1,2.4e-05,ANY +1605500020,15992.29,0.006878,ANY +1605500020,15992.29,2.2e-05,ANY +1605500021,15992.63,0.1,ANY +1605500022,15992.64,0.001486,ANY +1605500022,15992.64,0.004057,ANY +1605500022,15992.64,0.001357,ANY +1605500022,15992.64,0.123113,ANY +1605500024,15992.63,0.047182,ANY +1605500024,15992.63,0.048577,ANY +1605500024,15992.63,0.049041,ANY +1605500024,15992.64,0.001459,ANY +1605500024,15992.63,0.00073,ANY +1605500024,15992.64,0.001155,ANY +1605500024,15992.64,0.000541,ANY +1605500024,15992.64,0.002,ANY +1605500025,15993.09,0.00674,ANY +1605500025,15993.09,0.019522,ANY +1605500027,15992.86,0.0069,ANY +1605500027,15992.86,0.038049,ANY +1605500027,15992.86,0.002,ANY +1605500027,15992.86,0.015107,ANY +1605500029,15992.47,0.016795,ANY +1605500029,15992.47,0.008015,ANY +1605500030,15992.46,0.003705,ANY diff --git a/testdata/http_mock/binance/binance.json b/testdata/http_mock/binance/binance.json index 1c84dcb1..4310b772 100644 --- a/testdata/http_mock/binance/binance.json +++ b/testdata/http_mock/binance/binance.json @@ -114150,6 +114150,28146 @@ "queryString": "endTime=1577836799000\u0026interval=1d\u0026limit=1000\u0026startTime=1546300800000\u0026symbol=BTCUSDT", "bodyParams": "", "headers": {} + }, + { + "data": [ + [ + 1546041600000, + "3839.00000000", + "3892.00000000", + "3670.00000000", + "3695.32000000", + "38874.37390300", + 1546127999999, + "148205200.10773722", + 244844, + "19522.19304600", + "74500753.17536026", + "0" + ], + [ + 1546128000000, + "3696.71000000", + "3903.50000000", + "3657.90000000", + "3801.91000000", + "33222.36926200", + 1546214399999, + "124966229.52022896", + 218929, + "17427.34228500", + "65587964.90351099", + "0" + ], + [ + 1546214400000, + "3803.12000000", + "3810.00000000", + "3630.33000000", + "3702.90000000", + "29991.77835000", + 1546300799999, + "111847216.11708208", + 190308, + "15523.79613400", + "57912258.76286516", + "0" + ], + [ + 1546300800000, + "3701.23000000", + "3810.16000000", + "3642.00000000", + "3797.14000000", + "23741.68703300", + 1546387199999, + "88149249.09230461", + 154227, + "12919.15589900", + "47973435.86685800", + "0" + ], + [ + 1546387200000, + "3796.45000000", + "3882.14000000", + "3750.45000000", + "3858.56000000", + "35156.46336900", + 1546473599999, + "133876627.24651060", + 218538, + "17921.60011400", + "68277897.66105788", + "0" + ], + [ + 1546473600000, + "3857.57000000", + "3862.74000000", + "3730.00000000", + "3766.78000000", + "29406.94835900", + 1546559999999, + "111657372.69526468", + 199812, + "14793.08326700", + "56172495.42692984", + "0" + ], + [ + 1546560000000, + "3767.20000000", + "3823.64000000", + "3703.57000000", + "3792.01000000", + "29519.55467100", + 1546646399999, + "111034550.64066196", + 192232, + "15579.30325800", + "58616203.97789647", + "0" + ], + [ + 1546646400000, + "3790.09000000", + "3840.99000000", + "3751.00000000", + "3770.96000000", + "30490.66775100", + 1546732799999, + "115893501.27515878", + 203673, + "14908.91417500", + "56667455.38615935", + "0" + ], + [ + 1546732800000, + "3771.12000000", + "4027.71000000", + "3740.00000000", + "3987.60000000", + "36553.80670900", + 1546819199999, + "142198812.18914709", + 240496, + "19772.88700800", + "76903705.93007119", + "0" + ], + [ + 1546819200000, + "3987.62000000", + "4017.90000000", + "3921.53000000", + "3975.45000000", + "31869.84626400", + 1546905599999, + "126830380.49287239", + 221219, + "16404.35224100", + "65287611.65056139", + "0" + ], + [ + 1546905600000, + "3976.76000000", + "4069.80000000", + "3903.00000000", + "3955.13000000", + "38901.42312200", + 1546991999999, + "154778846.54236616", + 242898, + "20047.97760100", + "79781104.89538665", + "0" + ], + [ + 1546992000000, + "3955.45000000", + "4006.81000000", + "3930.04000000", + "3966.65000000", + "28989.43951100", + 1547078399999, + "115218950.31554872", + 209240, + "14984.33702000", + "59559010.74523400", + "0" + ], + [ + 1547078400000, + "3966.06000000", + "3996.01000000", + "3540.00000000", + "3585.88000000", + "59402.22851000", + 1547164799999, + "221789348.03469807", + 374760, + "28288.32257400", + "105616252.06340843", + "0" + ], + [ + 1547164800000, + "3585.88000000", + "3658.00000000", + "3465.00000000", + "3601.31000000", + "38338.65473300", + 1547251199999, + "137560743.62485982", + 264996, + "19907.35058600", + "71430015.64522145", + "0" + ], + [ + 1547251200000, + "3601.31000000", + "3618.19000000", + "3530.00000000", + "3583.13000000", + "21999.92835400", + 1547337599999, + "78908770.67658037", + 175679, + "11645.59884600", + "41778835.50680978", + "0" + ], + [ + 1547337600000, + "3584.10000000", + "3611.10000000", + "3441.30000000", + "3476.81000000", + "26385.75745400", + 1547423999999, + "92882249.46737902", + 183113, + "13692.42064000", + "48229503.01532720", + "0" + ], + [ + 1547424000000, + "3477.56000000", + "3671.87000000", + "3467.02000000", + "3626.09000000", + "35235.21121500", + 1547510399999, + "125631820.06705057", + 229452, + "18416.41690200", + "65668831.10400985", + "0" + ], + [ + 1547510400000, + "3626.08000000", + "3648.42000000", + "3516.62000000", + "3553.06000000", + "34137.99745900", + 1547596799999, + "122785440.22887539", + 231684, + "17225.62243400", + "61971796.91256990", + "0" + ], + [ + 1547596800000, + "3553.06000000", + "3645.00000000", + "3543.51000000", + "3591.84000000", + "27480.17997700", + 1547683199999, + "98504455.20666535", + 205159, + "14183.69988000", + "50843136.81523343", + "0" + ], + [ + 1547683200000, + "3591.84000000", + "3634.70000000", + "3530.39000000", + "3616.21000000", + "29755.44083800", + 1547769599999, + "106709136.97324342", + 217797, + "16010.50339500", + "57427195.93767381", + "0" + ], + [ + 1547769600000, + "3613.32000000", + "3620.00000000", + "3565.75000000", + "3594.87000000", + "22713.44675500", + 1547855999999, + "81699723.54479144", + 177567, + "12611.08375700", + "45362975.23668103", + "0" + ], + [ + 1547856000000, + "3594.87000000", + "3720.00000000", + "3594.23000000", + "3665.30000000", + "22171.57812300", + 1547942399999, + "81354185.90325992", + 175054, + "11637.25817100", + "42690540.30785225", + "0" + ], + [ + 1547942400000, + "3665.75000000", + "3693.73000000", + "3475.00000000", + "3539.28000000", + "27901.93859800", + 1548028799999, + "99767239.95381454", + 204941, + "13875.11138100", + "49633530.63808028", + "0" + ], + [ + 1548028800000, + "3539.26000000", + "3559.51000000", + "3475.50000000", + "3526.90000000", + "19644.43683900", + 1548115199999, + "69316548.76685554", + 160825, + "10462.02027800", + "36918177.63501831", + "0" + ], + [ + 1548115200000, + "3526.88000000", + "3608.50000000", + "3434.85000000", + "3570.93000000", + "29336.44296700", + 1548201599999, + "103804480.11605988", + 195484, + "15661.33300100", + "55461347.69397660", + "0" + ], + [ + 1548201600000, + "3570.41000000", + "3607.98000000", + "3514.50000000", + "3552.82000000", + "24938.84269800", + 1548287999999, + "88816396.34583544", + 192892, + "13136.69325300", + "46789527.00878810", + "0" + ], + [ + 1548288000000, + "3552.97000000", + "3589.00000000", + "3529.22000000", + "3569.62000000", + "20826.25118000", + 1548374399999, + "74037052.86632736", + 162159, + "10975.97457000", + "39023591.88152408", + "0" + ], + [ + 1548374400000, + "3569.07000000", + "3587.15000000", + "3522.51000000", + "3565.29000000", + "17608.34667100", + 1548460799999, + "62634926.45524528", + 153413, + "9690.39815200", + "34473989.38670668", + "0" + ], + [ + 1548460800000, + "3566.69000000", + "3662.94000000", + "3545.00000000", + "3565.25000000", + "19476.53234400", + 1548547199999, + "69841766.64693149", + 135369, + "10203.40031500", + "36578851.51879908", + "0" + ], + [ + 1548547200000, + "3565.62000000", + "3579.00000000", + "3486.00000000", + "3550.84000000", + "22735.59816200", + 1548633599999, + "80743416.84653682", + 163855, + "11568.56739900", + "41100311.44740031", + "0" + ], + [ + 1548633600000, + "3550.05000000", + "3557.75000000", + "3380.27000000", + "3434.15000000", + "40405.11140100", + 1548719999999, + "139258708.76430879", + 260799, + "20334.27173900", + "70100390.81728584", + "0" + ], + [ + 1548720000000, + "3434.00000000", + "3443.45000000", + "3349.92000000", + "3411.04000000", + "29544.92897700", + 1548806399999, + "100542807.46479908", + 189650, + "15626.31123100", + "53180295.18051735", + "0" + ], + [ + 1548806400000, + "3410.04000000", + "3478.00000000", + "3387.10000000", + "3458.18000000", + "23968.26024300", + 1548892799999, + "82521122.86191754", + 180820, + "13324.33962800", + "45877250.05787340", + "0" + ], + [ + 1548892800000, + "3457.50000000", + "3489.20000000", + "3418.80000000", + "3434.10000000", + "29607.19025300", + 1548979199999, + "101928346.97699686", + 198100, + "15325.82878300", + "52764623.95051864", + "0" + ], + [ + 1548979200000, + "3434.10000000", + "3488.00000000", + "3401.20000000", + "3462.07000000", + "25260.47615900", + 1549065599999, + "87075914.23266830", + 167520, + "13533.34462800", + "46664199.94907889", + "0" + ], + [ + 1549065600000, + "3462.20000000", + "3526.40000000", + "3440.29000000", + "3504.77000000", + "17920.80200000", + 1549151999999, + "62134037.97539881", + 153234, + "9637.41923000", + "33417963.69624554", + "0" + ], + [ + 1549152000000, + "3504.06000000", + "3511.09000000", + "3426.00000000", + "3458.11000000", + "19867.33639000", + 1549238399999, + "68801620.06241606", + 138592, + "10126.71614300", + "35070884.46205618", + "0" + ], + [ + 1549238400000, + "3458.11000000", + "3484.88000000", + "3433.31000000", + "3463.22000000", + "23131.98110800", + 1549324799999, + "80024258.22766613", + 155686, + "12387.10978100", + "42856551.66874073", + "0" + ], + [ + 1549324800000, + "3463.22000000", + "3478.97000000", + "3448.43000000", + "3471.59000000", + "25264.41503000", + 1549411199999, + "87491347.06381486", + 162066, + "13642.82308400", + "47248405.24357039", + "0" + ], + [ + 1549411200000, + "3471.57000000", + "3482.72000000", + "3380.00000000", + "3405.37000000", + "35310.24484600", + 1549497599999, + "120500703.00515730", + 207024, + "18054.00834700", + "61609674.49994292", + "0" + ], + [ + 1549497600000, + "3407.00000000", + "3426.45000000", + "3390.00000000", + "3398.40000000", + "18665.53863800", + 1549583999999, + "63611505.78657223", + 148209, + "9971.89096000", + "33985909.98028422", + "0" + ], + [ + 1549584000000, + "3398.40000000", + "3733.58000000", + "3373.10000000", + "3659.04000000", + "47968.05801300", + 1549670399999, + "170118212.46197886", + 277242, + "25500.97034500", + "90453750.95066435", + "0" + ], + [ + 1549670400000, + "3660.27000000", + "3680.02000000", + "3625.13000000", + "3665.18000000", + "24759.83371900", + 1549756799999, + "90488500.06766240", + 192209, + "13208.14275000", + "48274378.26417207", + "0" + ], + [ + 1549756800000, + "3665.18000000", + "3684.99000000", + "3609.76000000", + "3680.06000000", + "23250.60263400", + 1549843199999, + "84696423.96233752", + 171099, + "12445.22054600", + "45337811.06485932", + "0" + ], + [ + 1549843200000, + "3679.75000000", + "3684.90000000", + "3615.53000000", + "3631.05000000", + "24954.61457100", + 1549929599999, + "90731831.90427426", + 172626, + "12713.19166600", + "46221559.64321214", + "0" + ], + [ + 1549929600000, + "3631.05000000", + "3667.60000000", + "3582.34000000", + "3631.46000000", + "29479.59823000", + 1550015999999, + "106766439.99436474", + 198996, + "14986.11962900", + "54283275.96877608", + "0" + ], + [ + 1550016000000, + "3631.51000000", + "3670.00000000", + "3591.75000000", + "3609.40000000", + "25773.99764800", + 1550102399999, + "93350740.94830574", + 167690, + "13552.84642000", + "49100779.82827613", + "0" + ], + [ + 1550102400000, + "3608.34000000", + "3626.40000000", + "3568.11000000", + "3590.56000000", + "21753.50126100", + 1550188799999, + "78367545.57945933", + 155215, + "11271.17502000", + "40602592.45976747", + "0" + ], + [ + 1550188800000, + "3590.57000000", + "3653.23000000", + "3573.45000000", + "3602.47000000", + "20777.87289900", + 1550275199999, + "74938358.18352868", + 151256, + "10840.39689500", + "39106496.49706577", + "0" + ], + [ + 1550275200000, + "3602.49000000", + "3648.20000000", + "3597.91000000", + "3618.41000000", + "19565.99275100", + 1550361599999, + "70894921.80761533", + 149393, + "10452.11973000", + "37873280.57143865", + "0" + ], + [ + 1550361600000, + "3617.22000000", + "3700.11000000", + "3604.40000000", + "3667.58000000", + "25690.22777900", + 1550447999999, + "93426433.13226133", + 179511, + "13004.16467600", + "47317986.79403941", + "0" + ], + [ + 1550448000000, + "3667.62000000", + "3925.00000000", + "3655.00000000", + "3898.60000000", + "64042.73049200", + 1550534399999, + "242898012.76922592", + 393515, + "33934.97317100", + "128779026.65413163", + "0" + ], + [ + 1550534400000, + "3897.35000000", + "3994.52000000", + "3856.00000000", + "3907.79000000", + "50207.17266700", + 1550620799999, + "197091641.04739993", + 332281, + "27008.59756600", + "106038298.75034281", + "0" + ], + [ + 1550620800000, + "3907.35000000", + "3986.98000000", + "3870.66000000", + "3969.74000000", + "36205.14085000", + 1550707199999, + "142571564.56112989", + 250176, + "19952.70098400", + "78593009.21716801", + "0" + ], + [ + 1550707200000, + "3969.74000000", + "4016.48000000", + "3901.03000000", + "3937.31000000", + "31103.88472800", + 1550793599999, + "122714273.87417651", + 209571, + "16678.73094500", + "65816472.08951928", + "0" + ], + [ + 1550793600000, + "3937.31000000", + "3988.00000000", + "3926.65000000", + "3962.00000000", + "23943.16375000", + 1550879999999, + "94739322.74557025", + 179588, + "12932.07849400", + "51172984.85084170", + "0" + ], + [ + 1550880000000, + "3962.00000000", + "4162.02000000", + "3933.15000000", + "4117.76000000", + "33657.94288300", + 1550966399999, + "135782959.41827349", + 231563, + "17790.39681500", + "71727695.50468791", + "0" + ], + [ + 1550966400000, + "4118.00000000", + "4198.00000000", + "3712.66000000", + "3743.56000000", + "62224.18689000", + 1551052799999, + "244146803.51886994", + 410578, + "30284.98096300", + "118938981.43024275", + "0" + ], + [ + 1551052800000, + "3743.56000000", + "3872.66000000", + "3740.00000000", + "3827.92000000", + "38102.96624500", + 1551139199999, + "145285565.20317070", + 262716, + "20414.12531600", + "77851143.96719552", + "0" + ], + [ + 1551139200000, + "3828.44000000", + "3841.51000000", + "3777.00000000", + "3809.23000000", + "28838.74803600", + 1551225599999, + "109932596.10609363", + 213897, + "14790.21331100", + "56376982.48230529", + "0" + ], + [ + 1551225600000, + "3809.31000000", + "3838.85000000", + "3677.17000000", + "3818.07000000", + "31500.99546600", + 1551311999999, + "119564023.12004227", + 201626, + "16214.23584600", + "61560455.27515973", + "0" + ], + [ + 1551312000000, + "3818.04000000", + "3888.00000000", + "3763.87000000", + "3813.69000000", + "32561.96104400", + 1551398399999, + "124703738.39336836", + 233849, + "16907.09230100", + "64761233.24960861", + "0" + ], + [ + 1551398400000, + "3814.26000000", + "3857.00000000", + "3813.01000000", + "3823.00000000", + "23174.57217000", + 1551484799999, + "88851336.52111789", + 179860, + "12773.95259500", + "48982541.74343915", + "0" + ], + [ + 1551484800000, + "3822.17000000", + "3841.31000000", + "3772.25000000", + "3819.93000000", + "19445.83835500", + 1551571199999, + "74175357.77882297", + 149854, + "10248.94565500", + "39098061.94664881", + "0" + ], + [ + 1551571200000, + "3819.97000000", + "3835.00000000", + "3781.32000000", + "3807.75000000", + "16718.16541000", + 1551657599999, + "63791898.99159701", + 127681, + "8854.21887800", + "33793163.48606208", + "0" + ], + [ + 1551657600000, + "3807.32000000", + "3830.00000000", + "3670.69000000", + "3715.30000000", + "34742.84166000", + 1551743999999, + "129739738.23815794", + 218615, + "18023.02240700", + "67312533.26381876", + "0" + ], + [ + 1551744000000, + "3716.10000000", + "3877.10000000", + "3703.55000000", + "3857.73000000", + "32962.53616200", + 1551830399999, + "124945530.76214453", + 202444, + "17980.12771200", + "68134618.18206475", + "0" + ], + [ + 1551830400000, + "3857.58000000", + "3907.00000000", + "3813.09000000", + "3861.84000000", + "24775.11883000", + 1551916799999, + "95417637.58898660", + 165101, + "13139.77457300", + "50622286.06205380", + "0" + ], + [ + 1551916800000, + "3861.84000000", + "3905.40000000", + "3840.40000000", + "3873.64000000", + "26455.25766100", + 1552003199999, + "102585458.38333898", + 180520, + "13365.94621300", + "51827450.49331647", + "0" + ], + [ + 1552003200000, + "3873.63000000", + "3932.00000000", + "3800.00000000", + "3864.89000000", + "34730.36659200", + 1552089599999, + "135000852.01035948", + 211534, + "17947.93422800", + "69791058.74747885", + "0" + ], + [ + 1552089600000, + "3864.88000000", + "3971.75000000", + "3854.75000000", + "3943.04000000", + "30979.74765300", + 1552175999999, + "121353606.96803356", + 206869, + "16447.34655800", + "64429542.99978998", + "0" + ], + [ + 1552176000000, + "3943.43000000", + "3943.43000000", + "3881.69000000", + "3916.82000000", + "23187.56141200", + 1552262399999, + "90693949.72150731", + 167920, + "12518.49638600", + "48968093.08714351", + "0" + ], + [ + 1552262400000, + "3915.99000000", + "3936.98000000", + "3830.00000000", + "3871.61000000", + "38066.88570500", + 1552348799999, + "147721971.09446938", + 209916, + "19416.22101400", + "75329574.17851433", + "0" + ], + [ + 1552348800000, + "3871.61000000", + "3905.20000000", + "3826.06000000", + "3882.73000000", + "26921.00862200", + 1552435199999, + "104393849.44844826", + 182885, + "13827.42106500", + "53624520.45494350", + "0" + ], + [ + 1552435200000, + "3882.69000000", + "3893.56000000", + "3840.00000000", + "3866.00000000", + "24461.00875700", + 1552521599999, + "94680049.46033754", + 186572, + "12839.14650500", + "49699859.82552118", + "0" + ], + [ + 1552521600000, + "3866.00000000", + "3920.00000000", + "3810.43000000", + "3877.12000000", + "27048.74853000", + 1552607999999, + "104673038.77602254", + 196651, + "14244.45531900", + "55141147.28364773", + "0" + ], + [ + 1552608000000, + "3877.12000000", + "3939.22000000", + "3872.20000000", + "3923.76000000", + "21740.06149800", + 1552694399999, + "84919900.71744472", + 163866, + "12025.70553400", + "46979306.89873034", + "0" + ], + [ + 1552694400000, + "3924.46000000", + "4056.98000000", + "3921.98000000", + "4005.98000000", + "28568.37612400", + 1552780799999, + "114227606.40681695", + 216198, + "15580.63108000", + "62301622.91259946", + "0" + ], + [ + 1552780800000, + "4005.98000000", + "4012.00000000", + "3950.01000000", + "3981.14000000", + "18814.25557700", + 1552867199999, + "74893913.05776027", + 146953, + "9927.11655900", + "39524144.17139103", + "0" + ], + [ + 1552867200000, + "3981.85000000", + "4037.00000000", + "3953.33000000", + "3987.81000000", + "22454.47801000", + 1552953599999, + "89526258.38910637", + 157876, + "11964.18976900", + "47710908.05709871", + "0" + ], + [ + 1552953600000, + "3987.83000000", + "4031.00000000", + "3970.00000000", + "4015.53000000", + "19893.74181500", + 1553039999999, + "79503748.36263466", + 147394, + "10745.63056500", + "42949860.70592456", + "0" + ], + [ + 1553040000000, + "4017.48000000", + "4050.00000000", + "3980.50000000", + "4043.04000000", + "23432.30025500", + 1553126399999, + "94019734.23326426", + 175036, + "12201.21427900", + "48961351.11750316", + "0" + ], + [ + 1553126400000, + "4043.04000000", + "4069.32000000", + "3880.01000000", + "3980.64000000", + "35997.68211900", + 1553212799999, + "144010401.50845117", + 236100, + "18704.22183700", + "74835394.39208286", + "0" + ], + [ + 1553212800000, + "3980.85000000", + "4008.00000000", + "3968.25000000", + "3986.93000000", + "20022.60631800", + 1553299199999, + "79861943.81089970", + 153703, + "10561.69457700", + "42127893.35065794", + "0" + ], + [ + 1553299200000, + "3987.89000000", + "4018.83000000", + "3978.01000000", + "4006.01000000", + "17302.60431800", + 1553385599999, + "69169819.86286371", + 143155, + "9491.14472800", + "37945846.04025019", + "0" + ], + [ + 1553385600000, + "4006.01000000", + "4006.02000000", + "3950.00000000", + "3992.18000000", + "17179.85064800", + 1553471999999, + "68524082.74695625", + 131087, + "8617.36592500", + "34375232.36909545", + "0" + ], + [ + 1553472000000, + "3991.35000000", + "3999.30000000", + "3888.71000000", + "3936.12000000", + "33192.89021700", + 1553558399999, + "131507366.37512891", + 227739, + "17050.63482700", + "67573128.16531547", + "0" + ], + [ + 1553558400000, + "3935.47000000", + "3958.98000000", + "3894.00000000", + "3948.55000000", + "29349.53762700", + 1553644799999, + "115330070.99071545", + 192418, + "15963.90520500", + "62738463.89189890", + "0" + ], + [ + 1553644800000, + "3948.77000000", + "4048.00000000", + "3936.15000000", + "4038.05000000", + "32364.55585200", + 1553731199999, + "129681258.01621350", + 224309, + "17964.55060100", + "71983196.76062553", + "0" + ], + [ + 1553731200000, + "4039.58000000", + "4039.70000000", + "4002.00000000", + "4027.81000000", + "20089.29387500", + 1553817599999, + "80822230.57984656", + 157060, + "10111.82627600", + "40683986.77430117", + "0" + ], + [ + 1553817600000, + "4028.22000000", + "4123.71000000", + "4024.03000000", + "4103.25000000", + "30084.21744400", + 1553903999999, + "122585822.58650480", + 203826, + "16800.50957200", + "68459620.27240319", + "0" + ], + [ + 1553904000000, + "4104.24000000", + "4140.00000000", + "4052.00000000", + "4106.97000000", + "19509.29260100", + 1553990399999, + "79853835.58182401", + 162463, + "10322.14877500", + "42255037.00428935", + "0" + ], + [ + 1553990400000, + "4106.99000000", + "4116.12000000", + "4082.57000000", + "4103.95000000", + "13525.08743300", + 1554076799999, + "55472147.12701675", + 124046, + "6824.65737800", + "27993469.17112726", + "0" + ], + [ + 1554076800000, + "4102.44000000", + "4158.70000000", + "4067.00000000", + "4144.56000000", + "25507.06764100", + 1554163199999, + "105388238.14788892", + 184268, + "12915.28932000", + "53371959.95327402", + "0" + ], + [ + 1554163200000, + "4144.54000000", + "4897.99000000", + "4140.54000000", + "4857.29000000", + "105383.63926300", + 1554249599999, + "489018726.75750669", + 609133, + "55726.14168400", + "258300768.81540301", + "0" + ], + [ + 1554249600000, + "4857.19000000", + "5275.01000000", + "4753.50000000", + "4932.60000000", + "109890.12574300", + 1554335999999, + "548900970.91788429", + 692019, + "55975.58476100", + "279654422.07491424", + "0" + ], + [ + 1554336000000, + "4932.59000000", + "5039.08000000", + "4777.00000000", + "4898.66000000", + "61054.25416800", + 1554422399999, + "301411332.00902432", + 419141, + "31203.30835400", + "154090564.79115182", + "0" + ], + [ + 1554422400000, + "4898.64000000", + "5028.22000000", + "4880.62000000", + "5004.95000000", + "39768.55280600", + 1554508799999, + "197660830.71096662", + 292375, + "21235.63623700", + "105586318.20991643", + "0" + ], + [ + 1554508800000, + "5004.96000000", + "5205.00000000", + "4928.59000000", + "5043.89000000", + "41770.84231300", + 1554595199999, + "210963411.61313188", + 281237, + "21796.02186900", + "110119190.88917793", + "0" + ], + [ + 1554595200000, + "5042.07000000", + "5234.00000000", + "5026.00000000", + "5170.27000000", + "37615.48680400", + 1554681599999, + "192916750.57190406", + 274084, + "19504.61283200", + "100069310.55713653", + "0" + ], + [ + 1554681600000, + "5170.27000000", + "5305.00000000", + "5039.00000000", + "5236.90000000", + "50178.43078200", + 1554767999999, + "260487077.76756680", + 350828, + "25302.16540200", + "131396468.34738519", + "0" + ], + [ + 1554768000000, + "5238.38000000", + "5238.40000000", + "5076.68000000", + "5150.00000000", + "34067.01231100", + 1554854399999, + "175633627.31637351", + 253381, + "16967.00611500", + "87496291.75731626", + "0" + ], + [ + 1554854400000, + "5150.00000000", + "5422.00000000", + "5135.00000000", + "5308.25000000", + "40073.62047100", + 1554940799999, + "210870034.51205530", + 260967, + "21269.62094900", + "111952601.71234791", + "0" + ], + [ + 1554940800000, + "5307.86000000", + "5332.67000000", + "4927.00000000", + "5017.37000000", + "54696.60068600", + 1555027199999, + "277736905.85749792", + 369304, + "26631.11240900", + "135174561.68852918", + "0" + ], + [ + 1555027200000, + "5017.37000000", + "5080.58000000", + "4861.22000000", + "5048.01000000", + "33276.67861400", + 1555113599999, + "166485761.07931210", + 226036, + "16899.59053300", + "84561818.27888816", + "0" + ], + [ + 1555113600000, + "5047.00000000", + "5099.00000000", + "5004.00000000", + "5045.22000000", + "17292.45680200", + 1555199999999, + "87375984.44461506", + 138674, + "8692.05325900", + "43925293.92220215", + "0" + ], + [ + 1555200000000, + "5047.45000000", + "5152.99000000", + "5000.00000000", + "5131.30000000", + "18281.60773900", + 1555286399999, + "92594930.42710131", + 131700, + "10043.91166700", + "50893945.02767781", + "0" + ], + [ + 1555286400000, + "5131.28000000", + "5167.38000000", + "4950.00000000", + "5024.95000000", + "29057.19158100", + 1555372799999, + "147687551.94147710", + 204944, + "14170.25240200", + "72070166.00084409", + "0" + ], + [ + 1555372800000, + "5024.95000000", + "5197.72000000", + "5003.94000000", + "5173.72000000", + "24242.22949300", + 1555459199999, + "123581651.71216356", + 168550, + "12804.63376800", + "65290617.51599363", + "0" + ], + [ + 1555459200000, + "5173.72000000", + "5230.40000000", + "5146.80000000", + "5202.82000000", + "23307.53613400", + 1555545599999, + "120972345.51821637", + 179490, + "12172.53172400", + "63190167.89632924", + "0" + ], + [ + 1555545600000, + "5202.41000000", + "5287.00000000", + "5198.80000000", + "5258.44000000", + "22619.23900100", + 1555631999999, + "118573129.86520114", + 167110, + "12104.85293200", + "63464128.54331125", + "0" + ], + [ + 1555632000000, + "5258.44000000", + "5320.00000000", + "5175.00000000", + "5258.68000000", + "24611.23632300", + 1555718399999, + "128937309.63806376", + 178148, + "12889.68334400", + "67549701.12506344", + "0" + ], + [ + 1555718400000, + "5258.68000000", + "5333.42000000", + "5230.10000000", + "5291.73000000", + "19168.90827400", + 1555804799999, + "101343660.15324434", + 157080, + "10029.27226200", + "53029542.91017945", + "0" + ], + [ + 1555804800000, + "5292.91000000", + "5314.35000000", + "5165.00000000", + "5256.14000000", + "25549.57093900", + 1555891199999, + "133929931.15068736", + 210494, + "13147.77101600", + "68909870.81367928", + "0" + ], + [ + 1555891200000, + "5257.41000000", + "5400.00000000", + "5208.35000000", + "5357.14000000", + "29563.85230900", + 1555977599999, + "156632202.97099613", + 210361, + "15828.00485100", + "83879362.28322349", + "0" + ], + [ + 1555977600000, + "5357.14000000", + "5600.00000000", + "5332.41000000", + "5493.31000000", + "41262.10391700", + 1556063999999, + "227154061.85771411", + 282563, + "21260.01446900", + "117054771.35759218", + "0" + ], + [ + 1556064000000, + "5490.91000000", + "5582.20000000", + "5333.35000000", + "5415.00000000", + "48224.15241300", + 1556150399999, + "262493252.93584237", + 339599, + "23401.18852000", + "127419838.49784201", + "0" + ], + [ + 1556150400000, + "5415.00000000", + "5491.84000000", + "5102.00000000", + "5219.90000000", + "49636.08994800", + 1556236799999, + "265091565.61466024", + 331089, + "21401.17196500", + "114223925.41789762", + "0" + ], + [ + 1556236800000, + "5220.47000000", + "5510.00000000", + "5161.62000000", + "5314.10000000", + "48912.29451300", + 1556323199999, + "259659705.65138580", + 333183, + "25076.71829700", + "133163032.45656707", + "0" + ], + [ + 1556323200000, + "5315.00000000", + "5342.50000000", + "5257.67000000", + "5295.69000000", + "15422.89693500", + 1556409599999, + "81749716.42174439", + 145733, + "7918.22705600", + "41978251.89852615", + "0" + ], + [ + 1556409600000, + "5295.69000000", + "5340.00000000", + "5259.48000000", + "5307.52000000", + "14371.43386900", + 1556495999999, + "76277087.37424076", + 127730, + "7160.77372500", + "38011547.93921391", + "0" + ], + [ + 1556496000000, + "5309.81000000", + "5332.00000000", + "5178.80000000", + "5238.14000000", + "19918.13507900", + 1556582399999, + "104822151.51444980", + 178472, + "9983.62213700", + "52529726.63061370", + "0" + ], + [ + 1556582400000, + "5238.14000000", + "5339.98000000", + "5192.15000000", + "5320.81000000", + "22238.06823000", + 1556668799999, + "117309839.23079812", + 180989, + "12264.55293800", + "64721155.04645376", + "0" + ], + [ + 1556668800000, + "5321.94000000", + "5402.00000000", + "5316.20000000", + "5383.20000000", + "17217.47321600", + 1556755199999, + "92194935.60478040", + 161488, + "9636.26589900", + "51604847.88561128", + "0" + ], + [ + 1556755200000, + "5383.20000000", + "5538.00000000", + "5370.00000000", + "5492.87000000", + "22795.78783500", + 1556841599999, + "124498567.20765440", + 181896, + "11908.89589200", + "65029410.50078300", + "0" + ], + [ + 1556841600000, + "5494.81000000", + "5844.00000000", + "5477.57000000", + "5772.69000000", + "46297.17284900", + 1556927999999, + "264435878.92811019", + 338298, + "24992.74319000", + "142732584.07587240", + "0" + ], + [ + 1556928000000, + "5770.62000000", + "5900.00000000", + "5587.45000000", + "5829.45000000", + "39682.40899100", + 1557014399999, + "228942582.45077919", + 283145, + "21037.29947700", + "121524183.92743250", + "0" + ], + [ + 1557014400000, + "5829.83000000", + "5839.90000000", + "5696.00000000", + "5775.62000000", + "23822.54377500", + 1557100799999, + "137653160.76602159", + 185365, + "11824.08792100", + "68357177.93240788", + "0" + ], + [ + 1557100800000, + "5773.18000000", + "5805.00000000", + "5619.14000000", + "5747.79000000", + "25256.59632500", + 1557187199999, + "144358553.85462249", + 230431, + "12922.62549000", + "73880906.50332905", + "0" + ], + [ + 1557187200000, + "5749.92000000", + "6028.41000000", + "5747.74000000", + "5846.34000000", + "39905.06442200", + 1557273599999, + "236176663.81792103", + 301388, + "21302.98121700", + "126064101.91225619", + "0" + ], + [ + 1557273600000, + "5846.34000000", + "6014.72000000", + "5772.20000000", + "5987.29000000", + "23074.05152000", + 1557359999999, + "136245255.55720780", + 190966, + "11960.90403200", + "70659279.91367500", + "0" + ], + [ + 1557360000000, + "5986.66000000", + "6224.55000000", + "5983.71000000", + "6209.18000000", + "27453.01143600", + 1557446399999, + "167489934.34358988", + 227841, + "13875.18235600", + "84696142.54932348", + "0" + ], + [ + 1557446400000, + "6209.95000000", + "6468.92000000", + "6172.00000000", + "6373.33000000", + "36623.61079000", + 1557532799999, + "231801342.43209280", + 283074, + "18548.92799500", + "117379030.42732471", + "0" + ], + [ + 1557532800000, + "6375.16000000", + "7343.99000000", + "6372.85000000", + "7076.22000000", + "74022.42439300", + 1557619199999, + "507216001.34340413", + 562540, + "40091.99721500", + "274656200.80251044", + "0" + ], + [ + 1557619200000, + "7076.24000000", + "7521.78000000", + "6750.00000000", + "6967.31000000", + "86948.97533900", + 1557705599999, + "619939454.48965513", + 647345, + "42689.58967600", + "304720922.90832519", + "0" + ], + [ + 1557705600000, + "6968.24000000", + "8100.00000000", + "6870.00000000", + "7790.71000000", + "85804.73533300", + 1557791999999, + "648012612.29270131", + 588497, + "45381.26225900", + "342327287.01661900", + "0" + ], + [ + 1557792000000, + "7795.62000000", + "8366.00000000", + "7599.56000000", + "7947.56000000", + "76583.72260300", + 1557878399999, + "611103206.00327249", + 655426, + "38953.03233500", + "310810946.93725249", + "0" + ], + [ + 1557878400000, + "7945.26000000", + "8249.00000000", + "7850.00000000", + "8169.87000000", + "37884.32721100", + 1557964799999, + "305196285.27558238", + 347533, + "19660.57618600", + "158426245.70097857", + "0" + ], + [ + 1557964800000, + "8169.08000000", + "8320.00000000", + "7705.00000000", + "7866.59000000", + "69630.51399600", + 1558051199999, + "557126171.27896418", + 666538, + "35097.40415800", + "280897013.06816628", + "0" + ], + [ + 1558051200000, + "7868.67000000", + "7925.00000000", + "6913.00000000", + "7355.26000000", + "88752.00815900", + 1558137599999, + "645676487.37440289", + 803893, + "45121.47497800", + "328348049.16308968", + "0" + ], + [ + 1558137600000, + "7355.28000000", + "7458.00000000", + "7156.61000000", + "7257.45000000", + "37054.94477900", + 1558223999999, + "271170511.05093318", + 379504, + "19375.84836000", + "141830045.16939757", + "0" + ], + [ + 1558224000000, + "7257.32000000", + "8275.09000000", + "7243.08000000", + "8148.48000000", + "65577.44205800", + 1558310399999, + "517729474.35844101", + 583432, + "35593.49002200", + "281177713.21845129", + "0" + ], + [ + 1558310400000, + "8147.94000000", + "8156.03000000", + "7553.00000000", + "7938.15000000", + "65859.20856400", + 1558396799999, + "517939277.86885798", + 610360, + "34629.64564500", + "272371020.30677796", + "0" + ], + [ + 1558396800000, + "7937.16000000", + "8042.32000000", + "7771.00000000", + "7904.87000000", + "52301.75224700", + 1558483199999, + "413637782.36974554", + 554038, + "27272.36044800", + "215730616.60421489", + "0" + ], + [ + 1558483200000, + "7904.48000000", + "8016.00000000", + "7465.00000000", + "7628.43000000", + "49136.99458900", + 1558569599999, + "384730220.72195171", + 461337, + "24410.96266200", + "191296198.55463496", + "0" + ], + [ + 1558569600000, + "7627.80000000", + "7940.98000000", + "7461.00000000", + "7851.51000000", + "49648.18470100", + 1558655999999, + "381536239.51284835", + 449220, + "25959.85983800", + "199607980.98608009", + "0" + ], + [ + 1558656000000, + "7849.95000000", + "8130.00000000", + "7766.00000000", + "7964.87000000", + "46664.78532500", + 1558742399999, + "371381043.73160255", + 428676, + "25045.73342800", + "199347829.02587370", + "0" + ], + [ + 1558742400000, + "7964.52000000", + "8091.80000000", + "7908.34000000", + "8025.41000000", + "28414.32881700", + 1558828799999, + "227376280.58540762", + 264448, + "15037.16499600", + "120334124.30243574", + "0" + ], + [ + 1558828800000, + "8023.00000000", + "8740.00000000", + "7833.42000000", + "8614.43000000", + "49652.14456700", + 1558915199999, + "409616322.38847878", + 377306, + "26438.94680300", + "217911336.30408231", + "0" + ], + [ + 1558915200000, + "8612.54000000", + "8908.32000000", + "8589.00000000", + "8756.32000000", + "51886.76879300", + 1559001599999, + "452651204.93490235", + 478773, + "27722.36963700", + "241864670.65173968", + "0" + ], + [ + 1559001600000, + "8752.52000000", + "8798.49000000", + "8510.63000000", + "8715.64000000", + "31470.55153400", + 1559087999999, + "273791910.63147590", + 349123, + "16561.87681100", + "144108437.06115802", + "0" + ], + [ + 1559088000000, + "8716.87000000", + "8750.00000000", + "8406.60000000", + "8645.68000000", + "33880.86592200", + 1559174399999, + "292094591.01803866", + 352317, + "17575.58031700", + "151595491.23598413", + "0" + ], + [ + 1559174400000, + "8646.50000000", + "9074.26000000", + "8005.00000000", + "8269.54000000", + "70379.99852100", + 1559260799999, + "603312537.38084345", + 617341, + "34577.31059800", + "296613619.21904660", + "0" + ], + [ + 1559260800000, + "8267.10000000", + "8594.00000000", + "8108.50000000", + "8555.00000000", + "44727.49162000", + 1559347199999, + "373629673.91901440", + 416525, + "23391.68846000", + "195418655.05339947", + "0" + ], + [ + 1559347200000, + "8555.00000000", + "8626.00000000", + "8442.36000000", + "8544.07000000", + "31868.23415700", + 1559433599999, + "272098436.34069574", + 348375, + "16922.66242500", + "144486129.11826151", + "0" + ], + [ + 1559433600000, + "8545.10000000", + "8814.78000000", + "8524.00000000", + "8725.98000000", + "27835.13326500", + 1559519999999, + "241414596.71950513", + 299353, + "14585.88699900", + "126530020.38343657", + "0" + ], + [ + 1559520000000, + "8726.00000000", + "8800.95000000", + "8080.80000000", + "8115.82000000", + "45692.96510400", + 1559606399999, + "387155494.97304884", + 431252, + "22514.31685900", + "190882595.70344346", + "0" + ], + [ + 1559606400000, + "8115.66000000", + "8115.66000000", + "7481.02000000", + "7687.03000000", + "74143.94894100", + 1559692799999, + "582173398.32579679", + 645913, + "36776.59713100", + "288822568.04322012", + "0" + ], + [ + 1559692800000, + "7687.04000000", + "7896.70000000", + "7572.78000000", + "7776.50000000", + "48679.65645500", + 1559779199999, + "377635818.00440952", + 426120, + "26296.53395900", + "204082647.87673320", + "0" + ], + [ + 1559779200000, + "7778.08000000", + "7868.13000000", + "7444.58000000", + "7786.70000000", + "36624.11874700", + 1559865599999, + "282156410.54378911", + 371485, + "18877.98638300", + "145537581.79160799", + "0" + ], + [ + 1559865600000, + "7787.57000000", + "8100.00000000", + "7737.49000000", + "7980.53000000", + "33942.22565800", + 1559951999999, + "269125728.14164961", + 323096, + "17193.57559500", + "136343077.37705734", + "0" + ], + [ + 1559952000000, + "7978.94000000", + "8044.65000000", + "7751.00000000", + "7893.62000000", + "22657.32963400", + 1560038399999, + "179047320.02388046", + 250864, + "11795.09729400", + "93237148.47454820", + "0" + ], + [ + 1560038400000, + "7895.28000000", + "7935.00000000", + "7506.66000000", + "7628.13000000", + "31568.46515700", + 1560124799999, + "243970971.02443440", + 322175, + "16234.63127500", + "125591062.03917081", + "0" + ], + [ + 1560124800000, + "7627.57000000", + "8020.00000000", + "7511.00000000", + "7982.75000000", + "36756.07846800", + 1560211199999, + "287125339.97011443", + 387179, + "19890.86856100", + "155461282.83139249", + "0" + ], + [ + 1560211200000, + "7981.00000000", + "8010.00000000", + "7692.23000000", + "7884.90000000", + "30334.99942700", + 1560297599999, + "238031771.51747338", + 309059, + "15793.77245100", + "124001190.82079008", + "0" + ], + [ + 1560297600000, + "7884.90000000", + "8200.00000000", + "7788.99000000", + "8127.64000000", + "41597.08262200", + 1560383999999, + "333291726.64600021", + 361980, + "22826.90102600", + "182925127.46756544", + "0" + ], + [ + 1560384000000, + "8127.64000000", + "8309.82000000", + "8010.03000000", + "8218.54000000", + "30467.76434100", + 1560470399999, + "248418184.77204661", + 341246, + "16100.16134600", + "131293315.79862677", + "0" + ], + [ + 1560470400000, + "8216.44000000", + "8684.41000000", + "8144.32000000", + "8650.00000000", + "39835.24625500", + 1560556799999, + "333475488.55375949", + 410072, + "20970.62382700", + "175588531.48519169", + "0" + ], + [ + 1560556800000, + "8650.88000000", + "8864.99000000", + "8567.63000000", + "8808.70000000", + "31791.63603900", + 1560643199999, + "276420769.29338533", + 335840, + "16798.37929600", + "146051605.23593674", + "0" + ], + [ + 1560643200000, + "8810.77000000", + "9333.00000000", + "8760.00000000", + "8953.33000000", + "63289.25121900", + 1560729599999, + "574211342.97966031", + 552319, + "33804.18204600", + "306793742.10849278", + "0" + ], + [ + 1560729600000, + "8953.00000000", + "9444.00000000", + "8950.00000000", + "9313.96000000", + "47895.48537400", + 1560815999999, + "441567296.05926622", + 462160, + "24826.97685000", + "228962151.24115250", + "0" + ], + [ + 1560816000000, + "9312.13000000", + "9336.36000000", + "8950.00000000", + "9081.55000000", + "51554.56940100", + 1560902399999, + "470271954.29870564", + 449730, + "28057.04733500", + "255972426.13011804", + "0" + ], + [ + 1560902400000, + "9081.97000000", + "9304.00000000", + "8960.00000000", + "9255.49000000", + "32147.70649500", + 1560988799999, + "293748062.66684875", + 306202, + "17533.23301600", + "160303572.01579759", + "0" + ], + [ + 1560988800000, + "9253.76000000", + "9590.00000000", + "9175.20000000", + "9517.12000000", + "34556.05398200", + 1561075199999, + "323621848.19876171", + 350662, + "18032.19071400", + "168891671.53448428", + "0" + ], + [ + 1561075200000, + "9518.06000000", + "10174.99000000", + "9518.06000000", + "10159.86000000", + "50484.41589200", + 1561161599999, + "494783687.98535151", + 474344, + "28305.73274900", + "277616242.76671947", + "0" + ], + [ + 1561161600000, + "10159.86000000", + "11160.00000000", + "9921.72000000", + "10729.50000000", + "104169.44797600", + 1561247999999, + "1112069567.63811481", + 923334, + "55336.62358700", + "590676435.78882355", + "0" + ], + [ + 1561248000000, + "10729.00000000", + "11392.64000000", + "10555.18000000", + "10906.07000000", + "57445.32394500", + 1561334399999, + "625330374.74668832", + 557935, + "30129.80103300", + "327919162.55038311", + "0" + ], + [ + 1561334400000, + "10905.95000000", + "11143.63000000", + "10620.80000000", + "11056.59000000", + "43101.04528500", + 1561420799999, + "469746663.93811732", + 440335, + "22674.41385100", + "247193774.35494487", + "0" + ], + [ + 1561420800000, + "11056.59000000", + "11850.00000000", + "11026.00000000", + "11820.86000000", + "61276.68664800", + 1561507199999, + "697773986.26918588", + 597798, + "32838.33556600", + "373915513.28231270", + "0" + ], + [ + 1561507200000, + "11821.28000000", + "13970.00000000", + "11741.00000000", + "13093.80000000", + "155930.14738600", + 1561593599999, + "1996178374.59449220", + 1355074, + "76046.06420600", + "973444882.21756229", + "0" + ], + [ + 1561593600000, + "13098.38000000", + "13478.04000000", + "10525.10000000", + "11329.99000000", + "173894.82088900", + 1561679999999, + "2058443849.31399992", + 1357233, + "80442.11991600", + "951733425.60878133", + "0" + ], + [ + 1561680000000, + "11329.99000000", + "12480.00000000", + "10982.88000000", + "12400.63000000", + "95795.20396400", + 1561766399999, + "1129888341.32128373", + 883116, + "48847.10788300", + "576552254.91960096", + "0" + ], + [ + 1561766400000, + "12407.06000000", + "12441.54000000", + "11475.02000000", + "11903.13000000", + "69642.07415700", + 1561852799999, + "829011822.23653242", + 732073, + "36061.45936900", + "429403585.74678667", + "0" + ], + [ + 1561852800000, + "11903.13000000", + "12180.00000000", + "10766.03000000", + "10854.10000000", + "84512.53044300", + 1561939199999, + "971151050.90058159", + 711267, + "42697.44000000", + "492370966.31592094", + "0" + ], + [ + 1561939200000, + "10854.10000000", + "11282.28000000", + "10030.00000000", + "10624.93000000", + "90962.26827100", + 1562025599999, + "972343281.86035535", + 757458, + "44210.98836500", + "473020897.41183619", + "0" + ], + [ + 1562025600000, + "10624.90000000", + "10938.75000000", + "9727.00000000", + "10842.85000000", + "109561.03872800", + 1562111999999, + "1128353804.80079160", + 870148, + "54998.50360600", + "566863180.55092289", + "0" + ], + [ + 1562112000000, + "10844.98000000", + "11991.89000000", + "10841.04000000", + "11940.00000000", + "96815.90029000", + 1562198399999, + "1097804642.75777372", + 814754, + "49613.61674400", + "561585673.86519116", + "0" + ], + [ + 1562198400000, + "11940.00000000", + "12000.00000000", + "11055.00000000", + "11145.67000000", + "66512.22189200", + 1562284799999, + "775818897.38948483", + 643867, + "33626.85186200", + "392411806.43340068", + "0" + ], + [ + 1562284800000, + "11145.67000000", + "11406.83000000", + "10796.44000000", + "10970.73000000", + "63534.35058200", + 1562371199999, + "705853649.02648962", + 564857, + "32306.91425900", + "359142813.98810695", + "0" + ], + [ + 1562371200000, + "10982.41000000", + "11665.00000000", + "10964.51000000", + "11256.49000000", + "51469.49633100", + 1562457599999, + "585001376.15542908", + 470692, + "25601.98948200", + "291096287.94400300", + "0" + ], + [ + 1562457600000, + "11256.45000000", + "11538.00000000", + "11094.37000000", + "11406.24000000", + "38884.79559900", + 1562543999999, + "439439052.94554207", + 366769, + "22449.30112000", + "253820654.34123246", + "0" + ], + [ + 1562544000000, + "11410.00000000", + "12338.03000000", + "11220.00000000", + "12238.60000000", + "52182.36721500", + 1562630399999, + "618530684.43255227", + 507860, + "27740.09749000", + "328709707.94803343", + "0" + ], + [ + 1562630400000, + "12238.60000000", + "12794.73000000", + "12068.00000000", + "12543.41000000", + "78442.13034300", + 1562716799999, + "975986802.03003513", + 660273, + "40993.91197400", + "508388352.36049587", + "0" + ], + [ + 1562716800000, + "12548.51000000", + "13147.08000000", + "11569.00000000", + "12108.37000000", + "109246.04499700", + 1562803199999, + "1369749939.96750366", + 899391, + "46964.76090700", + "588798251.12483500", + "0" + ], + [ + 1562803200000, + "12108.11000000", + "12111.73000000", + "11000.00000000", + "11342.89000000", + "87506.46105800", + 1562889599999, + "1007356802.21825599", + 760057, + "43714.15617000", + "503407388.68365422", + "0" + ], + [ + 1562889600000, + "11342.88000000", + "11885.00000000", + "11073.00000000", + "11757.22000000", + "56321.85828100", + 1562975999999, + "649824820.76548135", + 537561, + "30291.11935600", + "349517968.90387331", + "0" + ], + [ + 1562976000000, + "11757.22000000", + "11799.98000000", + "10830.00000000", + "11355.76000000", + "54245.59454800", + 1563062399999, + "614050007.99194520", + 510305, + "26460.05823600", + "299649536.39435350", + "0" + ], + [ + 1563062400000, + "11355.78000000", + "11452.00000000", + "10103.00000000", + "10174.18000000", + "72517.57923600", + 1563148799999, + "777646151.60294671", + 649043, + "35853.69216000", + "384643236.23562616", + "0" + ], + [ + 1563148800000, + "10174.18000000", + "11100.00000000", + "9860.00000000", + "10838.72000000", + "81922.42633200", + 1563235199999, + "851028723.70318576", + 732206, + "41714.18965500", + "433767828.49457312", + "0" + ], + [ + 1563235200000, + "10833.78000000", + "11028.00000000", + "9350.01000000", + "9439.59000000", + "97219.44341300", + 1563321599999, + "982462166.69322945", + 796646, + "47295.94404800", + "478852520.00356246", + "0" + ], + [ + 1563321600000, + "9430.17000000", + "9957.00000000", + "9060.00000000", + "9667.92000000", + "84942.67271700", + 1563407999999, + "809555508.34767892", + 757742, + "43073.11514600", + "410754257.70738602", + "0" + ], + [ + 1563408000000, + "9668.86000000", + "10788.00000000", + "9252.00000000", + "10627.16000000", + "80283.31025200", + 1563494399999, + "807822745.18543276", + 734821, + "42103.34474500", + "423743857.79454611", + "0" + ], + [ + 1563494400000, + "10628.64000000", + "10769.71000000", + "10121.84000000", + "10504.29000000", + "56546.93213300", + 1563580799999, + "589931612.34198640", + 567735, + "29070.35747400", + "303508985.60686395", + "0" + ], + [ + 1563580800000, + "10505.78000000", + "11068.99000000", + "10350.00000000", + "10740.23000000", + "47331.89984800", + 1563667199999, + "505569016.35008299", + 461660, + "25003.62155000", + "267188169.93959161", + "0" + ], + [ + 1563667200000, + "10740.27000000", + "10817.90000000", + "10288.00000000", + "10589.45000000", + "38834.28793500", + 1563753599999, + "409661485.99856461", + 395452, + "20345.52738400", + "214610701.20268620", + "0" + ], + [ + 1563753600000, + "10590.15000000", + "10683.16000000", + "10100.00000000", + "10340.31000000", + "40467.95483900", + 1563839999999, + "421016379.36208768", + 389565, + "19335.41190000", + "201324461.22845032", + "0" + ], + [ + 1563840000000, + "10343.08000000", + "10343.97000000", + "9822.00000000", + "9864.91000000", + "47624.37071000", + 1563926399999, + "478441909.40505734", + 448147, + "24082.30912900", + "241965620.20266604", + "0" + ], + [ + 1563926400000, + "9864.78000000", + "9937.00000000", + "9525.00000000", + "9763.28000000", + "43475.38037700", + 1564012799999, + "422534162.14571223", + 424762, + "21963.77353700", + "213526693.38815349", + "0" + ], + [ + 1564012800000, + "9763.40000000", + "10175.00000000", + "9720.03000000", + "9879.87000000", + "37873.35472800", + 1564099199999, + "378938450.08176742", + 368176, + "19308.01142600", + "193241603.01232005", + "0" + ], + [ + 1564099200000, + "9882.15000000", + "9889.98000000", + "9637.00000000", + "9824.00000000", + "27167.46321700", + 1564185599999, + "265108103.13392133", + 299935, + "14006.62943400", + "136688126.95394775", + "0" + ], + [ + 1564185600000, + "9824.00000000", + "10188.66000000", + "9333.00000000", + "9476.52000000", + "43809.77830100", + 1564271999999, + "424932724.96873150", + 401418, + "21428.05231800", + "208090741.11042415", + "0" + ], + [ + 1564272000000, + "9478.92000000", + "9594.99000000", + "9165.00000000", + "9541.54000000", + "29401.02293700", + 1564358399999, + "278537286.13481345", + 271327, + "17116.43313200", + "162267204.15845968", + "0" + ], + [ + 1564358400000, + "9541.54000000", + "9729.00000000", + "9395.00000000", + "9507.64000000", + "29021.93741100", + 1564444799999, + "277497756.76841674", + 294468, + "16075.16697100", + "153791418.10329246", + "0" + ], + [ + 1564444800000, + "9509.07000000", + "9714.28000000", + "9402.00000000", + "9574.21000000", + "32536.36883400", + 1564531199999, + "310867928.28793913", + 283961, + "17211.00965300", + "164621319.04418956", + "0" + ], + [ + 1564531200000, + "9575.00000000", + "10109.80000000", + "9555.00000000", + "10080.53000000", + "39515.35456000", + 1564617599999, + "389690761.44466112", + 364212, + "21235.60960400", + "209506872.50921800", + "0" + ], + [ + 1564617600000, + "10080.53000000", + "10467.86000000", + "9863.46000000", + "10374.99000000", + "41727.63702800", + 1564703999999, + "422156523.66900791", + 378062, + "22244.91946700", + "225207082.39426738", + "0" + ], + [ + 1564704000000, + "10375.00000000", + "10670.00000000", + "10281.35000000", + "10523.75000000", + "42990.44422100", + 1564790399999, + "450323284.15075973", + 431322, + "22206.13509300", + "232638457.60696326", + "0" + ], + [ + 1564790400000, + "10523.75000000", + "10904.77000000", + "10497.93000000", + "10816.86000000", + "33802.31882400", + 1564876799999, + "363852799.87178007", + 348893, + "18132.52970700", + "195125820.47946514", + "0" + ], + [ + 1564876800000, + "10816.86000000", + "11040.00000000", + "10552.00000000", + "10929.23000000", + "39924.74514100", + 1564963199999, + "431793873.42329756", + 353721, + "22066.36825700", + "238959952.23516081", + "0" + ], + [ + 1564963200000, + "10929.99000000", + "11937.52000000", + "10927.80000000", + "11828.80000000", + "65153.67371300", + 1565049599999, + "757976547.21704611", + 622610, + "33530.07066000", + "389969213.39891764", + "0" + ], + [ + 1565049600000, + "11830.00000000", + "12330.70000000", + "11226.70000000", + "11481.69000000", + "76705.38987500", + 1565135999999, + "904119081.61571263", + 625827, + "37522.11697200", + "442937542.04071641", + "0" + ], + [ + 1565136000000, + "11481.69000000", + "12141.17000000", + "11382.84000000", + "11975.03000000", + "69173.39035300", + 1565222399999, + "814597979.05050404", + 592916, + "36357.22591800", + "428496665.57006503", + "0" + ], + [ + 1565222400000, + "11975.04000000", + "12060.00000000", + "11521.00000000", + "11999.77000000", + "51207.25717400", + 1565308799999, + "604389131.06283610", + 473584, + "27463.20076300", + "324785966.12659640", + "0" + ], + [ + 1565308800000, + "11994.17000000", + "12045.68000000", + "11700.00000000", + "11879.99000000", + "39427.15258800", + 1565395199999, + "467011047.94142844", + 410902, + "20074.42191100", + "238009297.57960402", + "0" + ], + [ + 1565395200000, + "11879.98000000", + "11985.00000000", + "11270.00000000", + "11309.31000000", + "42633.08704800", + 1565481599999, + "492217964.49055574", + 399237, + "17111.12507600", + "197997879.10911432", + "0" + ], + [ + 1565481600000, + "11309.24000000", + "11600.00000000", + "11112.11000000", + "11549.97000000", + "26772.90691000", + 1565567999999, + "304862403.35144906", + 306234, + "15007.43820000", + "171032610.99181714", + "0" + ], + [ + 1565568000000, + "11539.08000000", + "11577.89000000", + "11235.32000000", + "11396.08000000", + "17568.22707500", + 1565654399999, + "200325471.60414099", + 255966, + "9200.43087900", + "104948602.15277771", + "0" + ], + [ + 1565654400000, + "11398.35000000", + "11456.16000000", + "10788.45000000", + "10892.71000000", + "33234.72968000", + 1565740799999, + "368994475.54611235", + 337834, + "13483.55870000", + "149693332.12683108", + "0" + ], + [ + 1565740800000, + "10893.36000000", + "10897.48000000", + "9928.10000000", + "10050.37000000", + "54451.84749900", + 1565827199999, + "567724729.10590593", + 534507, + "26080.63138100", + "271971667.55098168", + "0" + ], + [ + 1565827200000, + "10055.16000000", + "10460.00000000", + "9911.00000000", + "10293.93000000", + "38174.45112000", + 1565913599999, + "387705855.08791121", + 373368, + "19588.08291800", + "199059445.60425642", + "0" + ], + [ + 1565913600000, + "10296.77000000", + "10536.03000000", + "9750.00000000", + "10331.54000000", + "51758.14291800", + 1565999999999, + "527258446.39777652", + 504740, + "25818.03153700", + "263301246.89849174", + "0" + ], + [ + 1566000000000, + "10331.15000000", + "10465.14000000", + "10000.00000000", + "10216.02000000", + "29000.58120100", + 1566086399999, + "297776329.03058246", + 332795, + "14672.94974000", + "150792759.34523310", + "0" + ], + [ + 1566086400000, + "10216.05000000", + "10500.00000000", + "10080.00000000", + "10306.78000000", + "24085.39517200", + 1566172799999, + "248508872.45998642", + 265705, + "12961.47855700", + "133774771.71696787", + "0" + ], + [ + 1566172800000, + "10306.17000000", + "10930.00000000", + "10258.60000000", + "10915.54000000", + "37243.31921700", + 1566259199999, + "396233441.02745958", + 337022, + "20591.43657200", + "219085855.34458049", + "0" + ], + [ + 1566259200000, + "10914.73000000", + "10949.96000000", + "10560.00000000", + "10760.51000000", + "32298.92167900", + 1566345599999, + "346664453.13672654", + 305065, + "16017.54472900", + "172082522.17892725", + "0" + ], + [ + 1566345600000, + "10760.51000000", + "10804.13000000", + "9858.00000000", + "10142.57000000", + "47355.71928200", + 1566431999999, + "482889274.51791698", + 458814, + "21565.83056100", + "219533134.86528105", + "0" + ], + [ + 1566432000000, + "10140.82000000", + "10242.00000000", + "9762.00000000", + "10099.88000000", + "34059.64273800", + 1566518399999, + "341371442.90683880", + 401148, + "17921.95430000", + "179746967.23521429", + "0" + ], + [ + 1566518400000, + "10099.90000000", + "10445.00000000", + "10019.79000000", + "10389.55000000", + "27550.33617300", + 1566604799999, + "282732431.75207238", + 326866, + "14798.81633800", + "151926638.08027624", + "0" + ], + [ + 1566604800000, + "10388.16000000", + "10419.42000000", + "9890.00000000", + "10134.35000000", + "27692.45684400", + 1566691199999, + "279962133.62570987", + 313227, + "13623.56484100", + "137726211.36364345", + "0" + ], + [ + 1566691200000, + "10134.61000000", + "10333.00000000", + "9906.97000000", + "10142.69000000", + "26271.65739800", + 1566777599999, + "265132761.31704284", + 289956, + "12885.71773500", + "130202473.09027293", + "0" + ], + [ + 1566777600000, + "10142.69000000", + "10604.00000000", + "10137.93000000", + "10372.25000000", + "41687.51159900", + 1566863999999, + "432249835.49069725", + 405316, + "22666.59545200", + "235202578.43601217", + "0" + ], + [ + 1566864000000, + "10373.60000000", + "10391.08000000", + "10051.08000000", + "10185.05000000", + "28402.77538300", + 1566950399999, + "289340681.07895178", + 292888, + "13852.44213800", + "141207845.02919283", + "0" + ], + [ + 1566950400000, + "10185.69000000", + "10299.00000000", + "9601.01000000", + "9721.00000000", + "42110.55537500", + 1567036799999, + "420034883.00315258", + 381293, + "19430.82257300", + "194055407.18003406", + "0" + ], + [ + 1567036800000, + "9721.00000000", + "9724.00000000", + "9320.00000000", + "9498.44000000", + "35532.69491000", + 1567123199999, + "337838761.55728653", + 343887, + "17536.26844800", + "166811264.08255094", + "0" + ], + [ + 1567123200000, + "9499.01000000", + "9696.00000000", + "9350.41000000", + "9584.54000000", + "26834.31810400", + 1567209599999, + "255854874.45077452", + 259270, + "14227.87285100", + "135696420.41983487", + "0" + ], + [ + 1567209600000, + "9582.76000000", + "9684.51000000", + "9420.75000000", + "9587.47000000", + "17130.29007400", + 1567295999999, + "164116756.46299691", + 199188, + "8558.14821400", + "82010834.33875087", + "0" + ], + [ + 1567296000000, + "9588.74000000", + "9830.00000000", + "9520.00000000", + "9724.98000000", + "19545.40484300", + 1567382399999, + "188513289.12235729", + 191324, + "11545.61059800", + "111464034.38112413", + "0" + ], + [ + 1567382400000, + "9723.59000000", + "10450.00000000", + "9712.50000000", + "10340.00000000", + "44740.24809300", + 1567468799999, + "448462178.63038095", + 354155, + "25140.29612500", + "251933840.30794755", + "0" + ], + [ + 1567468800000, + "10340.00000000", + "10773.00000000", + "10272.00000000", + "10615.28000000", + "47998.37678100", + 1567555199999, + "505617667.39926684", + 416076, + "24734.30326400", + "260488377.88812712", + "0" + ], + [ + 1567555200000, + "10611.85000000", + "10799.00000000", + "10369.89000000", + "10567.02000000", + "43943.88902600", + 1567641599999, + "463526509.32593700", + 383457, + "22244.06765600", + "234731325.60204142", + "0" + ], + [ + 1567641600000, + "10565.92000000", + "10900.00000000", + "10450.00000000", + "10564.49000000", + "33970.96063900", + 1567727999999, + "358861340.78979007", + 309846, + "16535.14780700", + "174901090.47337497", + "0" + ], + [ + 1567728000000, + "10563.13000000", + "10905.87000000", + "10150.00000000", + "10298.73000000", + "58799.64095900", + 1567814399999, + "623662984.38433060", + 455334, + "29952.94442700", + "318275724.07277407", + "0" + ], + [ + 1567814400000, + "10298.71000000", + "10558.00000000", + "10288.57000000", + "10455.88000000", + "27637.87739200", + 1567900799999, + "287851131.18025769", + 272011, + "14673.48921600", + "152825898.95080234", + "0" + ], + [ + 1567900800000, + "10455.90000000", + "10592.50000000", + "10208.00000000", + "10381.18000000", + "23984.67201800", + 1567987199999, + "249900964.37153130", + 237752, + "10588.59245800", + "110370036.72549054", + "0" + ], + [ + 1567987200000, + "10381.24000000", + "10480.00000000", + "10068.50000000", + "10303.12000000", + "39835.72760800", + 1568073599999, + "409724831.94712268", + 330459, + "18729.47268400", + "192814736.82347485", + "0" + ], + [ + 1568073600000, + "10302.58000000", + "10384.99000000", + "9953.00000000", + "10098.15000000", + "28915.41222500", + 1568159999999, + "294323839.50700761", + 286763, + "13432.25682200", + "136876441.42321573", + "0" + ], + [ + 1568160000000, + "10098.19000000", + "10293.00000000", + "9880.00000000", + "10158.33000000", + "31953.82456200", + 1568246399999, + "321637085.47650871", + 309120, + "16583.81309700", + "167086058.18780477", + "0" + ], + [ + 1568246400000, + "10158.75000000", + "10448.81000000", + "10040.00000000", + "10415.01000000", + "34511.16275500", + 1568332799999, + "353390090.96777732", + 317881, + "18550.85320200", + "190066356.88701728", + "0" + ], + [ + 1568332800000, + "10415.01000000", + "10439.00000000", + "10153.00000000", + "10342.06000000", + "30280.33977600", + 1568419199999, + "311632094.25618850", + 304947, + "16763.85466300", + "172561765.65306618", + "0" + ], + [ + 1568419200000, + "10344.13000000", + "10419.99000000", + "10222.33000000", + "10335.02000000", + "23621.53351900", + 1568505599999, + "244063007.09022474", + 253929, + "13495.98669100", + "139491411.26572924", + "0" + ], + [ + 1568505600000, + "10332.81000000", + "10360.00000000", + "10252.15000000", + "10302.01000000", + "18047.65401300", + 1568591999999, + "185853330.43704256", + 194733, + "8221.80305500", + "84690636.88555922", + "0" + ], + [ + 1568592000000, + "10303.34000000", + "10355.00000000", + "10078.00000000", + "10251.31000000", + "28971.40165700", + 1568678399999, + "296325130.17090132", + 274368, + "13385.30225300", + "137008707.88664533", + "0" + ], + [ + 1568678400000, + "10249.68000000", + "10275.00000000", + "10128.01000000", + "10187.82000000", + "22914.32456300", + 1568764799999, + "233944812.56050799", + 287483, + "11195.43067300", + "114314296.20572508", + "0" + ], + [ + 1568764800000, + "10187.48000000", + "10258.02000000", + "10100.00000000", + "10156.99000000", + "24250.24930300", + 1568851199999, + "247024351.59799171", + 299466, + "11753.10911100", + "119777298.85924058", + "0" + ], + [ + 1568851200000, + "10156.41000000", + "10325.00000000", + "9653.00000000", + "10244.29000000", + "44826.28257900", + 1568937599999, + "447676492.98402635", + 429727, + "22623.28776300", + "226404409.68236710", + "0" + ], + [ + 1568937600000, + "10243.70000000", + "10281.00000000", + "10061.39000000", + "10168.59000000", + "25088.49106900", + 1569023999999, + "255205290.21183727", + 267032, + "12054.38488800", + "122687240.60518866", + "0" + ], + [ + 1569024000000, + "10167.92000000", + "10176.70000000", + "9900.00000000", + "9986.39000000", + "20544.17519600", + 1569110399999, + "206034034.50803514", + 245439, + "9285.85147900", + "93152981.29234466", + "0" + ], + [ + 1569110400000, + "9985.15000000", + "10089.00000000", + "9853.97000000", + "10028.87000000", + "22049.27525600", + 1569196799999, + "220133631.61284170", + 253713, + "11200.61192100", + "111864717.13240463", + "0" + ], + [ + 1569196800000, + "10028.05000000", + "10049.99000000", + "9615.77000000", + "9702.25000000", + "31937.23235600", + 1569283199999, + "314390584.62646132", + 332817, + "14940.11249600", + "147108768.54457945", + "0" + ], + [ + 1569283200000, + "9702.20000000", + "9794.99000000", + "7800.00000000", + "8493.14000000", + "94007.34520300", + 1569369599999, + "838996309.16112820", + 748712, + "42986.25312700", + "383608082.56863165", + "0" + ], + [ + 1569369600000, + "8497.55000000", + "8730.00000000", + "8215.64000000", + "8430.05000000", + "60783.89225800", + 1569455999999, + "512437200.36110440", + 544806, + "30489.47199400", + "257118054.54903361", + "0" + ], + [ + 1569456000000, + "8430.05000000", + "8465.99000000", + "7750.00000000", + "8063.73000000", + "67930.85374900", + 1569542399999, + "552794530.86668199", + 522062, + "33363.51365000", + "271728779.69954551", + "0" + ], + [ + 1569542400000, + "8063.49000000", + "8265.00000000", + "7852.15000000", + "8177.91000000", + "43882.92462500", + 1569628799999, + "352800745.20792857", + 369518, + "23224.86113500", + "186790633.03646185", + "0" + ], + [ + 1569628800000, + "8177.47000000", + "8315.00000000", + "8001.09000000", + "8198.81000000", + "34473.60516500", + 1569715199999, + "280672404.68049548", + 319113, + "18215.03986300", + "148326185.32000544", + "0" + ], + [ + 1569715200000, + "8199.38000000", + "8229.13000000", + "7890.00000000", + "8043.82000000", + "31544.21138800", + 1569801599999, + "253660600.32529288", + 322501, + "15507.40078100", + "124764250.17575432", + "0" + ], + [ + 1569801600000, + "8043.04000000", + "8337.26000000", + "7710.00000000", + "8289.34000000", + "55865.48726000", + 1569887999999, + "449120676.84276034", + 455556, + "29052.01095100", + "233783108.23169308", + "0" + ], + [ + 1569888000000, + "8289.97000000", + "8500.00000000", + "8173.05000000", + "8292.44000000", + "43472.41809100", + 1569974399999, + "362980689.87999125", + 387653, + "22518.98439500", + "188065394.22718111", + "0" + ], + [ + 1569974400000, + "8292.67000000", + "8373.91000000", + "8151.22000000", + "8359.94000000", + "26243.38664400", + 1570060799999, + "216325351.85864461", + 261430, + "13652.36085000", + "112568257.13363141", + "0" + ], + [ + 1570060800000, + "8360.00000000", + "8393.00000000", + "8060.00000000", + "8223.96000000", + "30488.28405800", + 1570147199999, + "250291751.27141390", + 281307, + "15321.40753500", + "125826457.09252053", + "0" + ], + [ + 1570147200000, + "8224.43000000", + "8232.41000000", + "8005.00000000", + "8137.13000000", + "26476.33040400", + 1570233599999, + "215325611.68221507", + 259012, + "13236.81025500", + "107708233.74574784", + "0" + ], + [ + 1570233600000, + "8137.09000000", + "8183.41000000", + "8012.98000000", + "8126.19000000", + "21907.61556400", + 1570319999999, + "177252877.00296909", + 237769, + "10620.06982200", + "85943843.84390094", + "0" + ], + [ + 1570320000000, + "8127.55000000", + "8153.87000000", + "7785.00000000", + "7854.25000000", + "34676.10404900", + 1570406399999, + "275447898.03287501", + 325795, + "16437.31014100", + "130619830.63356862", + "0" + ], + [ + 1570406400000, + "7855.30000000", + "8299.92000000", + "7762.00000000", + "8190.09000000", + "52202.07229700", + 1570492799999, + "420921679.84426315", + 482605, + "28088.64970400", + "226592301.64382157", + "0" + ], + [ + 1570492800000, + "8190.82000000", + "8325.00000000", + "8088.75000000", + "8168.39000000", + "35452.65742300", + 1570579199999, + "290675248.14144530", + 395685, + "16893.73714000", + "138551354.17557934", + "0" + ], + [ + 1570579200000, + "8170.79000000", + "8670.00000000", + "8115.00000000", + "8560.74000000", + "55038.70437800", + 1570665599999, + "462845251.81361025", + 537805, + "29211.87169000", + "245678414.82929021", + "0" + ], + [ + 1570665600000, + "8562.15000000", + "8644.00000000", + "8414.52000000", + "8558.03000000", + "39137.94616700", + 1570751999999, + "333925412.30414180", + 406932, + "20587.71397100", + "175682847.81235146", + "0" + ], + [ + 1570752000000, + "8557.82000000", + "8779.51000000", + "8212.38000000", + "8258.50000000", + "50405.28441800", + 1570838399999, + "424413201.53293220", + 471818, + "24618.01713500", + "207347909.97597683", + "0" + ], + [ + 1570838400000, + "8257.95000000", + "8400.00000000", + "8250.00000000", + "8300.09000000", + "21339.33409800", + 1570924799999, + "177707852.59481888", + 280633, + "11644.42954400", + "96979920.39843419", + "0" + ], + [ + 1570924800000, + "8301.98000000", + "8451.37000000", + "8160.00000000", + "8275.01000000", + "27840.73995300", + 1571011199999, + "232149438.36395869", + 320051, + "14035.91465400", + "117101482.90464429", + "0" + ], + [ + 1571011200000, + "8275.24000000", + "8388.85000000", + "8203.00000000", + "8348.20000000", + "29810.66325300", + 1571097599999, + "247530733.18003484", + 345679, + "15273.00375500", + "126831374.41473168", + "0" + ], + [ + 1571097600000, + "8346.86000000", + "8403.00000000", + "8090.00000000", + "8159.29000000", + "32773.06247600", + 1571183999999, + "270727559.77701092", + 399447, + "16822.94001500", + "139031758.65565604", + "0" + ], + [ + 1571184000000, + "8159.30000000", + "8181.16000000", + "7917.00000000", + "7991.74000000", + "34733.59396600", + 1571270399999, + "279586845.53621386", + 421026, + "17198.82797600", + "138510455.77691367", + "0" + ], + [ + 1571270400000, + "7995.02000000", + "8124.92000000", + "7929.03000000", + "8070.58000000", + "29656.94915800", + 1571356799999, + "238343204.48251529", + 356490, + "15922.04605800", + "127960055.04589145", + "0" + ], + [ + 1571356800000, + "8070.71000000", + "8115.00000000", + "7816.01000000", + "7947.01000000", + "31353.18141600", + 1571443199999, + "248931322.10085052", + 399783, + "15692.63445000", + "124639536.56963075", + "0" + ], + [ + 1571443200000, + "7946.89000000", + "8098.10000000", + "7866.92000000", + "7948.01000000", + "26627.88938800", + 1571529599999, + "211909734.13572005", + 349746, + "13886.83824400", + "110541248.17503742", + "0" + ], + [ + 1571529600000, + "7949.87000000", + "8297.00000000", + "7870.00000000", + "8223.35000000", + "34286.45265400", + 1571615999999, + "275899861.65387123", + 396091, + "18042.42367700", + "145235373.21216156", + "0" + ], + [ + 1571616000000, + "8223.35000000", + "8333.00000000", + "8142.03000000", + "8197.27000000", + "30448.67953900", + 1571702399999, + "250117281.63661337", + 367169, + "16584.00038400", + "136247602.03863662", + "0" + ], + [ + 1571702400000, + "8197.28000000", + "8297.99000000", + "8000.00000000", + "8020.00000000", + "34651.82866300", + 1571788799999, + "283535483.41051363", + 384699, + "16767.03682400", + "137253195.95826291", + "0" + ], + [ + 1571788800000, + "8020.06000000", + "8047.59000000", + "7300.00000000", + "7466.62000000", + "63897.45709800", + 1571875199999, + "488220760.64641560", + 610241, + "28473.73030200", + "217502083.43670305", + "0" + ], + [ + 1571875200000, + "7468.47000000", + "7503.68000000", + "7337.99000000", + "7412.41000000", + "32714.38326500", + 1571961599999, + "243246414.94892389", + 403778, + "16705.37635500", + "124225722.47547963", + "0" + ], + [ + 1571961600000, + "7412.41000000", + "8799.00000000", + "7361.00000000", + "8655.02000000", + "90748.21817400", + 1572047999999, + "737329544.88351963", + 775418, + "49588.97661200", + "402740312.18785392", + "0" + ], + [ + 1572048000000, + "8655.88000000", + "10370.00000000", + "8470.38000000", + "9230.00000000", + "162588.58541300", + 1572134399999, + "1522244166.41084847", + 1185369, + "81590.33653100", + "764040095.62121791", + "0" + ], + [ + 1572134400000, + "9230.00000000", + "9794.98000000", + "9074.34000000", + "9529.93000000", + "93833.54160400", + 1572220799999, + "887438297.74626678", + 799978, + "47320.55467000", + "447629005.39656268", + "0" + ], + [ + 1572220800000, + "9528.23000000", + "9902.10000000", + "9160.00000000", + "9205.14000000", + "80174.21732300", + 1572307199999, + "759178942.94884192", + 681128, + "39754.68150100", + "376584590.21858095", + "0" + ], + [ + 1572307200000, + "9204.45000000", + "9550.00000000", + "9072.00000000", + "9407.62000000", + "64158.46244600", + 1572393599999, + "600611324.63569959", + 559589, + "32787.04917400", + "307062268.41991786", + "0" + ], + [ + 1572393600000, + "9407.62000000", + "9409.84000000", + "9001.01000000", + "9154.72000000", + "55241.78643400", + 1572479999999, + "506584830.03133233", + 524035, + "27416.56174800", + "251452283.20530460", + "0" + ], + [ + 1572480000000, + "9154.02000000", + "9405.00000000", + "8913.00000000", + "9140.85000000", + "54376.02490200", + 1572566399999, + "498152743.73480882", + 490183, + "27252.20353600", + "249802680.66380806", + "0" + ], + [ + 1572566400000, + "9140.86000000", + "9279.00000000", + "9030.00000000", + "9231.61000000", + "43594.81411500", + 1572652799999, + "398803069.00908462", + 478002, + "22843.60504200", + "209045155.88095699", + "0" + ], + [ + 1572652800000, + "9231.40000000", + "9373.74000000", + "9186.21000000", + "9289.52000000", + "28923.06082800", + 1572739199999, + "268119579.73009112", + 325421, + "15316.18786300", + "141991067.15333212", + "0" + ], + [ + 1572739200000, + "9289.85000000", + "9362.57000000", + "9066.14000000", + "9194.71000000", + "27894.37827900", + 1572825599999, + "256664259.66219141", + 326024, + "13611.80655800", + "125328511.00426772", + "0" + ], + [ + 1572825600000, + "9196.46000000", + "9513.68000000", + "9115.84000000", + "9393.35000000", + "45894.45627700", + 1572911999999, + "426792003.17490647", + 453749, + "24741.81592500", + "230142613.20752436", + "0" + ], + [ + 1572912000000, + "9392.40000000", + "9454.95000000", + "9175.76000000", + "9308.66000000", + "45935.87366500", + 1572998399999, + "428156963.07854693", + 492885, + "22809.23955800", + "212668961.37619617", + "0" + ], + [ + 1572998400000, + "9307.73000000", + "9440.91000000", + "9250.01000000", + "9339.05000000", + "37336.17037200", + 1573084799999, + "348607499.83121694", + 402997, + "18947.02412700", + "176929534.86037745", + "0" + ], + [ + 1573084800000, + "9339.16000000", + "9375.00000000", + "9101.00000000", + "9216.20000000", + "39117.47085300", + 1573171199999, + "361217475.05834649", + 401984, + "19603.52357200", + "181092296.04003776", + "0" + ], + [ + 1573171200000, + "9214.00000000", + "9261.00000000", + "8696.00000000", + "8773.73000000", + "62107.28924300", + 1573257599999, + "555589995.99358589", + 567331, + "30046.12929100", + "268900339.26312254", + "0" + ], + [ + 1573257600000, + "8773.74000000", + "8880.00000000", + "8724.88000000", + "8809.41000000", + "29469.48140500", + 1573343999999, + "259733491.82990895", + 326730, + "14990.42224600", + "132136096.26889738", + "0" + ], + [ + 1573344000000, + "8809.18000000", + "9147.19000000", + "8750.00000000", + "9039.47000000", + "34422.02979700", + 1573430399999, + "307316853.90375426", + 375946, + "17722.19709000", + "158219187.66195828", + "0" + ], + [ + 1573430400000, + "9040.16000000", + "9072.32000000", + "8618.68000000", + "8733.27000000", + "44888.05354500", + 1573516799999, + "394585996.32928712", + 415982, + "22111.94305700", + "194310323.85678739", + "0" + ], + [ + 1573516800000, + "8733.36000000", + "8888.00000000", + "8567.60000000", + "8821.94000000", + "40366.62947100", + 1573603199999, + "352675938.43059302", + 406765, + "20225.03456000", + "176773688.17197935", + "0" + ], + [ + 1573603200000, + "8821.91000000", + "8844.99000000", + "8702.00000000", + "8777.12000000", + "26810.11691800", + 1573689599999, + "235060554.12410157", + 281593, + "13524.99303500", + "118583622.59890504", + "0" + ], + [ + 1573689600000, + "8777.54000000", + "8800.00000000", + "8582.60000000", + "8646.68000000", + "33468.46896100", + 1573775999999, + "290104306.95303317", + 337019, + "16272.81678500", + "141092283.63703056", + "0" + ], + [ + 1573776000000, + "8646.38000000", + "8790.00000000", + "8400.00000000", + "8471.73000000", + "46087.41775100", + 1573862399999, + "394708981.31557231", + 423919, + "22568.29011700", + "193359510.76146770", + "0" + ], + [ + 1573862400000, + "8471.62000000", + "8543.00000000", + "8400.00000000", + "8491.02000000", + "20902.29975200", + 1573948799999, + "177222838.38564817", + 231473, + "10703.62978400", + "90759494.93371469", + "0" + ], + [ + 1573948800000, + "8490.74000000", + "8635.00000000", + "8350.68000000", + "8502.40000000", + "27009.03708200", + 1574035199999, + "229995700.81158423", + 259594, + "13607.51617900", + "115878483.61499645", + "0" + ], + [ + 1574035200000, + "8502.87000000", + "8503.52000000", + "8060.00000000", + "8187.17000000", + "43017.69094000", + 1574121599999, + "358706174.82521841", + 366263, + "20525.11692400", + "171255974.96099598", + "0" + ], + [ + 1574121600000, + "8186.50000000", + "8218.63000000", + "8003.00000000", + "8133.64000000", + "43556.06102500", + 1574207999999, + "353463792.04443395", + 357382, + "21816.72508400", + "177061624.17883486", + "0" + ], + [ + 1574208000000, + "8133.83000000", + "8264.29000000", + "8038.40000000", + "8098.01000000", + "32466.23098000", + 1574294399999, + "263387575.48592199", + 288843, + "16751.18645900", + "135913703.28376596", + "0" + ], + [ + 1574294400000, + "8098.56000000", + "8134.73000000", + "7500.00000000", + "7627.74000000", + "58418.78026100", + 1574380799999, + "455166676.27818021", + 430062, + "26902.36985100", + "209669250.00512216", + "0" + ], + [ + 1574380800000, + "7627.79000000", + "7750.00000000", + "6790.00000000", + "7268.23000000", + "126603.14025900", + 1574467199999, + "917881536.26208392", + 817604, + "60867.91218200", + "441369226.60627317", + "0" + ], + [ + 1574467200000, + "7268.23000000", + "7344.48000000", + "7080.01000000", + "7311.57000000", + "50449.89475500", + 1574553599999, + "364446217.37376043", + 414045, + "25882.63146600", + "187044325.06936933", + "0" + ], + [ + 1574553600000, + "7311.10000000", + "7330.39000000", + "6861.00000000", + "6903.28000000", + "67890.20648300", + 1574639999999, + "481922941.32697582", + 446014, + "33387.52869500", + "237048588.06349042", + "0" + ], + [ + 1574640000000, + "6900.23000000", + "7377.69000000", + "6515.00000000", + "7109.57000000", + "119645.73519700", + 1574726399999, + "831628458.30490691", + 679721, + "60533.39361300", + "421590444.06566384", + "0" + ], + [ + 1574726400000, + "7109.99000000", + "7340.00000000", + "7017.48000000", + "7156.14000000", + "65722.39769000", + 1574812799999, + "469602476.91268085", + 433933, + "33301.34994100", + "237985219.12113364", + "0" + ], + [ + 1574812800000, + "7154.75000000", + "7655.00000000", + "6840.00000000", + "7508.52000000", + "92452.87349000", + 1574899199999, + "671646609.16955084", + 582055, + "47058.02874400", + "342164140.18315736", + "0" + ], + [ + 1574899200000, + "7507.90000000", + "7643.00000000", + "7360.00000000", + "7419.49000000", + "56933.98110900", + 1574985599999, + "427572714.94560073", + 388953, + "28876.70895200", + "216954965.99168930", + "0" + ], + [ + 1574985600000, + "7418.52000000", + "7850.00000000", + "7362.30000000", + "7739.68000000", + "60745.30087300", + 1575071999999, + "463006956.68515143", + 412929, + "31576.88619000", + "240751084.86781706", + "0" + ], + [ + 1575072000000, + "7740.99000000", + "7810.00000000", + "7441.00000000", + "7541.89000000", + "46989.43361900", + 1575158399999, + "358749026.36075541", + 346506, + "23743.61033700", + "181318684.76790961", + "0" + ], + [ + 1575158400000, + "7540.63000000", + "7541.85000000", + "7210.00000000", + "7390.89000000", + "60769.34231300", + 1575244799999, + "446524917.20597040", + 420573, + "31120.00293200", + "228709227.47478201", + "0" + ], + [ + 1575244800000, + "7391.50000000", + "7420.56000000", + "7151.10000000", + "7294.28000000", + "46330.25604000", + 1575331199999, + "337889295.51018099", + 326881, + "24043.61639300", + "175417845.96777071", + "0" + ], + [ + 1575331200000, + "7294.42000000", + "7400.00000000", + "7241.35000000", + "7292.71000000", + "33149.47748700", + 1575417599999, + "242379261.10434754", + 265391, + "16639.29483700", + "121693871.29329204", + "0" + ], + [ + 1575417600000, + "7292.71000000", + "7750.00000000", + "7067.00000000", + "7194.32000000", + "83147.14914200", + 1575503999999, + "608623482.75992315", + 516158, + "41867.07805700", + "306621278.81212719", + "0" + ], + [ + 1575504000000, + "7194.59000000", + "7485.00000000", + "7150.00000000", + "7389.00000000", + "59306.67885500", + 1575590399999, + "434738864.78401241", + 430359, + "30794.87400900", + "225785929.45196422", + "0" + ], + [ + 1575590400000, + "7389.00000000", + "7590.03000000", + "7305.00000000", + "7527.47000000", + "48189.08794400", + 1575676799999, + "356905919.01555993", + 367854, + "25901.01433400", + "191894551.37719464", + "0" + ], + [ + 1575676800000, + "7527.80000000", + "7619.62000000", + "7470.16000000", + "7488.21000000", + "31498.68417300", + 1575763199999, + "237000924.85530462", + 263592, + "16179.18492200", + "121730405.77530764", + "0" + ], + [ + 1575763200000, + "7487.31000000", + "7564.00000000", + "7374.86000000", + "7510.11000000", + "29856.89763100", + 1575849599999, + "223314325.61846468", + 257514, + "15295.64625000", + "114410839.18893658", + "0" + ], + [ + 1575849600000, + "7510.11000000", + "7650.00000000", + "7273.00000000", + "7338.64000000", + "46621.88749300", + 1575935999999, + "347471155.48268330", + 359648, + "23733.12631700", + "176936408.77023645", + "0" + ], + [ + 1575936000000, + "7338.64000000", + "7407.60000000", + "7157.10000000", + "7224.13000000", + "49723.76214000", + 1576022399999, + "363127435.39551666", + 439637, + "24739.06415300", + "180700991.44760172", + "0" + ], + [ + 1576022400000, + "7224.15000000", + "7275.50000000", + "7125.66000000", + "7210.00000000", + "30093.09194400", + 1576108799999, + "217095653.86658926", + 268269, + "15475.53917200", + "111646214.45842433", + "0" + ], + [ + 1576108800000, + "7210.00000000", + "7295.00000000", + "7080.30000000", + "7198.08000000", + "42288.60093200", + 1576195199999, + "303657479.49269097", + 331414, + "20847.38402600", + "149736412.31992898", + "0" + ], + [ + 1576195200000, + "7197.76000000", + "7309.05000000", + "7190.76000000", + "7258.48000000", + "27609.87379500", + 1576281599999, + "199836160.23365225", + 252135, + "14299.03325600", + "103507284.73033177", + "0" + ], + [ + 1576281600000, + "7257.37000000", + "7271.77000000", + "7012.00000000", + "7064.05000000", + "29561.98596700", + 1576367999999, + "211004228.01585397", + 276819, + "14397.27374300", + "102799669.53690346", + "0" + ], + [ + 1576368000000, + "7064.14000000", + "7200.30000000", + "7008.35000000", + "7118.59000000", + "26395.77813700", + 1576454399999, + "187402764.56353110", + 262651, + "13778.88014600", + "97846824.91339022", + "0" + ], + [ + 1576454400000, + "7119.60000000", + "7150.00000000", + "6836.00000000", + "6891.72000000", + "43863.99305900", + 1576540799999, + "307508569.89251376", + 371202, + "21512.68837100", + "150883357.87501083", + "0" + ], + [ + 1576540800000, + "6891.44000000", + "6942.21000000", + "6560.00000000", + "6623.82000000", + "53865.06992900", + 1576627199999, + "364087469.82227792", + 454097, + "26510.45395100", + "179268531.68762408", + "0" + ], + [ + 1576627200000, + "6623.84000000", + "7440.00000000", + "6435.00000000", + "7277.83000000", + "95636.65125100", + 1576713599999, + "654057202.15882882", + 714073, + "49843.65081700", + "341707270.92404456", + "0" + ], + [ + 1576713600000, + "7277.83000000", + "7380.00000000", + "7038.31000000", + "7150.30000000", + "55509.04907500", + 1576799999999, + "397407677.05856507", + 439761, + "27456.52827200", + "196558003.60942764", + "0" + ], + [ + 1576800000000, + "7151.31000000", + "7220.00000000", + "7079.50000000", + "7187.83000000", + "32132.06920500", + 1576886399999, + "229842650.42149539", + 312766, + "16641.05268900", + "119044689.29161471", + "0" + ], + [ + 1576886400000, + "7188.01000000", + "7190.58000000", + "7105.00000000", + "7132.75000000", + "19467.17402800", + 1576972799999, + "139069157.08645769", + 212162, + "10119.76101200", + "72297064.99889134", + "0" + ], + [ + 1576972800000, + "7131.59000000", + "7518.54000000", + "7122.47000000", + "7501.44000000", + "39137.45515000", + 1577059199999, + "285577206.94063478", + 356612, + "20625.43673200", + "150554135.68143037", + "0" + ], + [ + 1577059200000, + "7500.71000000", + "7695.38000000", + "7265.84000000", + "7317.09000000", + "68051.99720300", + 1577145599999, + "510710431.76686034", + 530669, + "33444.24377200", + "251116788.72529315", + "0" + ], + [ + 1577145600000, + "7317.30000000", + "7436.68000000", + "7157.04000000", + "7255.77000000", + "43629.49418800", + 1577231999999, + "318428019.00090993", + 384678, + "21552.75120600", + "157326354.03834855", + "0" + ], + [ + 1577232000000, + "7255.77000000", + "7271.77000000", + "7128.86000000", + "7204.63000000", + "27492.04432300", + 1577318399999, + "198273303.10954585", + 289924, + "14433.03899100", + "104115922.41287489", + "0" + ], + [ + 1577318400000, + "7205.01000000", + "7435.00000000", + "7157.12000000", + "7202.00000000", + "36259.76107600", + 1577404799999, + "263289798.95618758", + 337695, + "18887.86566500", + "137178762.78933651", + "0" + ], + [ + 1577404800000, + "7202.00000000", + "7275.86000000", + "7076.42000000", + "7254.74000000", + "33642.70186100", + 1577491199999, + "242214722.72289035", + 297262, + "16882.39676800", + "121593559.33506629", + "0" + ], + [ + 1577491200000, + "7254.77000000", + "7365.01000000", + "7238.67000000", + "7316.14000000", + "26848.98219900", + 1577577599999, + "196322192.43800189", + 272607, + "13894.47624200", + "101598406.02770426", + "0" + ], + [ + 1577577600000, + "7315.36000000", + "7528.45000000", + "7288.00000000", + "7388.24000000", + "31387.10608500", + 1577663999999, + "231731575.82821695", + 283213, + "15999.77782800", + "118139507.92862746", + "0" + ], + [ + 1577664000000, + "7388.43000000", + "7408.24000000", + "7220.00000000", + "7246.00000000", + "29605.91178200", + 1577750399999, + "216508875.51767525", + 279033, + "13768.25666400", + "100676879.90295008", + "0" + ], + [ + 1577750400000, + "7246.00000000", + "7320.00000000", + "7145.01000000", + "7195.23000000", + "25954.45353300", + 1577836799999, + "187518399.34504001", + 251976, + "12595.93034700", + "91036201.13783441", + "0" + ], + [ + 1577836800000, + "7195.24000000", + "7255.00000000", + "7175.15000000", + "7200.85000000", + "16792.38816500", + 1577923199999, + "121214452.11606228", + 194010, + "8946.95553500", + "64597785.21233434", + "0" + ], + [ + 1577923200000, + "7200.77000000", + "7212.50000000", + "6924.74000000", + "6965.71000000", + "31951.48393200", + 1578009599999, + "225982341.30114030", + 302667, + "15141.61134000", + "107060829.07806464", + "0" + ], + [ + 1578009600000, + "6965.49000000", + "7405.00000000", + "6871.04000000", + "7344.96000000", + "68428.50045100", + 1578095999999, + "495098582.96203543", + 519854, + "35595.49627300", + "257713113.85172859", + "0" + ], + [ + 1578096000000, + "7345.00000000", + "7404.00000000", + "7272.21000000", + "7354.11000000", + "29987.97497700", + 1578182399999, + "219874240.93994811", + 279370, + "16369.38224800", + "120035111.72407165", + "0" + ] + ], + "queryString": "endTime=1578096000000\u0026interval=1d\u0026limit=1000\u0026startTime=1546041600000\u0026symbol=BTCUSDT", + "bodyParams": "", + "headers": {} + }, + { + "data": [ + [ + 1588280400000, + "8819.15000000", + "8849.80000000", + "8734.50000000", + "8761.92000000", + "3089.56054500", + 1588283999999, + "27174569.16633405", + 34467, + "1553.36149800", + "13666586.86496907", + "0" + ], + [ + 1588284000000, + "8761.91000000", + "8770.00000000", + "8623.00000000", + "8759.77000000", + "3612.71399200", + 1588287599999, + "31442181.72038062", + 36111, + "1749.54292900", + "15228357.66528925", + "0" + ], + [ + 1588287600000, + "8759.82000000", + "8780.00000000", + "8573.98000000", + "8620.00000000", + "4202.15259200", + 1588291199999, + "36365483.65677274", + 38228, + "1920.13695200", + "16620790.27557015", + "0" + ], + [ + 1588291200000, + "8620.00000000", + "8739.01000000", + "8613.56000000", + "8707.51000000", + "3459.68866500", + 1588294799999, + "30048334.63131534", + 35104, + "1756.77408300", + "15257342.04754400", + "0" + ], + [ + 1588294800000, + "8707.50000000", + "8762.04000000", + "8657.85000000", + "8662.61000000", + "2271.60461400", + 1588298399999, + "19789676.93967357", + 26742, + "995.60091500", + "8675514.27165754", + "0" + ], + [ + 1588298400000, + "8663.07000000", + "8730.00000000", + "8644.32000000", + "8726.36000000", + "1827.66902000", + 1588301999999, + "15907238.22150173", + 20157, + "839.74346100", + "7308324.56422321", + "0" + ], + [ + 1588302000000, + "8725.50000000", + "8738.00000000", + "8665.26000000", + "8675.35000000", + "2038.99630500", + 1588305599999, + "17723267.93413456", + 22621, + "972.88607500", + "8457832.49659902", + "0" + ], + [ + 1588305600000, + "8675.10000000", + "8799.71000000", + "8674.01000000", + "8791.59000000", + "2605.77922700", + 1588309199999, + "22764778.16772638", + 28566, + "1492.54197200", + "13040131.85404562", + "0" + ], + [ + 1588309200000, + "8791.59000000", + "8835.70000000", + "8755.36000000", + "8815.42000000", + "3055.18048400", + 1588312799999, + "26892393.30694579", + 31383, + "1504.40495100", + "13242847.01103216", + "0" + ], + [ + 1588312800000, + "8815.27000000", + "8815.27000000", + "8745.93000000", + "8756.90000000", + "2006.71673600", + 1588316399999, + "17602896.84119039", + 22751, + "1049.50810400", + "9206551.08123321", + "0" + ], + [ + 1588316400000, + "8757.00000000", + "8780.00000000", + "8703.03000000", + "8767.18000000", + "3489.03986700", + 1588319999999, + "30508597.45136049", + 34988, + "2025.01322000", + "17706956.31561667", + "0" + ], + [ + 1588320000000, + "8767.18000000", + "8798.91000000", + "8745.01000000", + "8794.02000000", + "1928.32773600", + 1588323599999, + "16920391.78017899", + 23828, + "1009.03063100", + "8853661.78815122", + "0" + ], + [ + 1588323600000, + "8794.37000000", + "8860.00000000", + "8770.00000000", + "8845.52000000", + "3538.49593400", + 1588327199999, + "31177408.19710375", + 36239, + "2001.63520200", + "17639073.80013440", + "0" + ], + [ + 1588327200000, + "8845.71000000", + "8900.00000000", + "8815.82000000", + "8900.00000000", + "4227.33253300", + 1588330799999, + "37428615.35296002", + 36973, + "2229.07172100", + "19740100.98263396", + "0" + ], + [ + 1588330800000, + "8899.99000000", + "9059.18000000", + "8868.00000000", + "8995.66000000", + "9752.36998200", + 1588334399999, + "87399405.62578605", + 76112, + "5045.46928000", + "45223968.98591682", + "0" + ], + [ + 1588334400000, + "8995.73000000", + "9022.00000000", + "8815.00000000", + "8878.53000000", + "10373.21187900", + 1588337999999, + "92615020.32189327", + 73424, + "3992.62269300", + "35610323.68212108", + "0" + ], + [ + 1588338000000, + "8878.52000000", + "8925.00000000", + "8772.05000000", + "8792.20000000", + "6269.84674600", + 1588341599999, + "55365725.79882661", + 49736, + "2973.03060600", + "26254913.85458270", + "0" + ], + [ + 1588341600000, + "8792.20000000", + "8840.31000000", + "8716.28000000", + "8823.17000000", + "5851.25495100", + 1588345199999, + "51337021.58062206", + 47185, + "2684.41703300", + "23562811.53544659", + "0" + ], + [ + 1588345200000, + "8822.05000000", + "8858.68000000", + "8725.00000000", + "8726.84000000", + "4582.77466500", + 1588348799999, + "40306626.22088807", + 39770, + "2222.54005400", + "19556120.45311112", + "0" + ], + [ + 1588348800000, + "8726.88000000", + "8765.13000000", + "8655.31000000", + "8735.83000000", + "6069.70335000", + 1588352399999, + "52874957.02676310", + 54366, + "2730.63724300", + "23795999.79525456", + "0" + ], + [ + 1588352400000, + "8735.82000000", + "8768.85000000", + "8687.01000000", + "8762.74000000", + "3389.48654400", + 1588355999999, + "29599059.59815634", + 33418, + "1759.96252000", + "15372233.23029140", + "0" + ], + [ + 1588356000000, + "8763.42000000", + "8780.00000000", + "8721.00000000", + "8733.45000000", + "2169.86114700", + 1588359599999, + "18993936.01974329", + 25715, + "1021.72869800", + "8944811.33703888", + "0" + ], + [ + 1588359600000, + "8733.45000000", + "8772.71000000", + "8702.00000000", + "8727.82000000", + "2242.96668100", + 1588363199999, + "19592009.77303911", + 24189, + "1016.86960600", + "8882714.33784758", + "0" + ], + [ + 1588363200000, + "8727.97000000", + "8748.69000000", + "8663.28000000", + "8729.04000000", + "2407.46816500", + 1588366799999, + "20970814.94951279", + 29087, + "1090.09091600", + "9498346.80384979", + "0" + ], + [ + 1588366800000, + "8729.89000000", + "8849.99000000", + "8729.22000000", + "8844.67000000", + "2781.24982300", + 1588370399999, + "24450380.53699602", + 36753, + "1613.90582100", + "14183718.62571672", + "0" + ], + [ + 1588370400000, + "8844.66000000", + "8870.00000000", + "8796.23000000", + "8837.15000000", + "2492.51969100", + 1588373999999, + "22016079.46307947", + 27531, + "1351.29674000", + "11938748.07815877", + "0" + ], + [ + 1588374000000, + "8837.15000000", + "8893.43000000", + "8800.52000000", + "8826.96000000", + "2637.27031400", + 1588377599999, + "23355490.89147326", + 29322, + "1384.57293600", + "12263342.97165843", + "0" + ], + [ + 1588377600000, + "8825.67000000", + "8843.64000000", + "8762.00000000", + "8827.99000000", + "2148.83020000", + 1588381199999, + "18929699.56060789", + 26517, + "1036.18684300", + "9129847.73967405", + "0" + ], + [ + 1588381200000, + "8827.98000000", + "8829.00000000", + "8771.03000000", + "8792.17000000", + "1467.73748200", + 1588384799999, + "12919521.80162326", + 18851, + "656.19438000", + "5776703.01871699", + "0" + ], + [ + 1588384800000, + "8791.64000000", + "8838.54000000", + "8753.00000000", + "8812.35000000", + "1561.92846900", + 1588388399999, + "13743351.67920492", + 21403, + "777.37815900", + "6839552.52652245", + "0" + ], + [ + 1588388400000, + "8812.36000000", + "8856.40000000", + "8792.95000000", + "8834.08000000", + "1696.09847100", + 1588391999999, + "14978887.10187437", + 19404, + "869.03941800", + "7676251.79002337", + "0" + ], + [ + 1588392000000, + "8834.29000000", + "8856.76000000", + "8792.00000000", + "8818.51000000", + "1685.40784500", + 1588395599999, + "14871567.31417362", + 19077, + "739.98591600", + "6528847.03387410", + "0" + ], + [ + 1588395600000, + "8818.82000000", + "8832.18000000", + "8782.62000000", + "8816.42000000", + "1159.56242500", + 1588399199999, + "10210033.24027150", + 16916, + "620.02173500", + "5460135.08427448", + "0" + ], + [ + 1588399200000, + "8816.83000000", + "8846.00000000", + "8806.83000000", + "8822.85000000", + "1840.98875700", + 1588402799999, + "16258521.45064358", + 19795, + "1200.35009500", + "10601367.06091357", + "0" + ], + [ + 1588402800000, + "8822.21000000", + "8830.00000000", + "8783.49000000", + "8799.01000000", + "1810.69449200", + 1588406399999, + "15947508.15126184", + 19326, + "823.02592700", + "7250129.91491507", + "0" + ], + [ + 1588406400000, + "8799.00000000", + "8819.14000000", + "8768.00000000", + "8773.42000000", + "2269.55710100", + 1588409999999, + "19958508.47852519", + 21929, + "1274.82807100", + "11213527.82208780", + "0" + ], + [ + 1588410000000, + "8773.42000000", + "8822.95000000", + "8772.02000000", + "8811.90000000", + "1366.68038400", + 1588413599999, + "12030742.03535356", + 18147, + "661.70698500", + "5824995.03626185", + "0" + ], + [ + 1588413600000, + "8811.69000000", + "8846.62000000", + "8806.36000000", + "8828.23000000", + "3235.78097300", + 1588417199999, + "28568786.44413058", + 23009, + "2217.67507800", + "19583288.91185501", + "0" + ], + [ + 1588417200000, + "8828.22000000", + "8887.00000000", + "8828.22000000", + "8834.00000000", + "2788.44479100", + 1588420799999, + "24701413.90158219", + 29079, + "1599.86320300", + "14172673.44099425", + "0" + ], + [ + 1588420800000, + "8834.84000000", + "8940.00000000", + "8834.84000000", + "8859.35000000", + "4530.97424300", + 1588424399999, + "40309038.19931462", + 43580, + "2692.31691000", + "23950781.35549142", + "0" + ], + [ + 1588424400000, + "8859.80000000", + "8909.74000000", + "8850.86000000", + "8899.73000000", + "2068.58730700", + 1588427999999, + "18372656.52218446", + 23149, + "1006.60654300", + "8941467.10790910", + "0" + ], + [ + 1588428000000, + "8897.93000000", + "8950.00000000", + "8885.97000000", + "8919.51000000", + "3523.58659100", + 1588431599999, + "31420689.14027415", + 33356, + "1869.99844600", + "16677923.99091375", + "0" + ], + [ + 1588431600000, + "8919.19000000", + "8967.62000000", + "8894.00000000", + "8936.41000000", + "3733.74130500", + 1588435199999, + "33335741.52471180", + 36496, + "1807.91211700", + "16143967.69655134", + "0" + ], + [ + 1588435200000, + "8936.41000000", + "9010.00000000", + "8918.07000000", + "8980.63000000", + "4661.29148800", + 1588438799999, + "41848047.28170701", + 48976, + "2481.27938300", + "22281544.27137362", + "0" + ], + [ + 1588438800000, + "8980.93000000", + "8999.98000000", + "8948.00000000", + "8971.98000000", + "2331.02011900", + 1588442399999, + "20906314.53902943", + 29831, + "1075.95811100", + "9649518.96872791", + "0" + ], + [ + 1588442400000, + "8971.98000000", + "8972.00000000", + "8811.00000000", + "8866.72000000", + "5971.26414500", + 1588445999999, + "52964873.35915426", + 53814, + "2165.67573700", + "19201284.81809697", + "0" + ], + [ + 1588446000000, + "8867.08000000", + "8880.00000000", + "8820.00000000", + "8878.11000000", + "1839.81470900", + 1588449599999, + "16291738.45346659", + 22716, + "902.92301300", + "7997621.38859540", + "0" + ], + [ + 1588449600000, + "8878.00000000", + "8930.93000000", + "8860.00000000", + "8930.53000000", + "1694.23370400", + 1588453199999, + "15073090.29854533", + 21699, + "932.63388400", + "8296758.23692461", + "0" + ], + [ + 1588453200000, + "8930.53000000", + "8939.00000000", + "8883.15000000", + "8924.93000000", + "1575.51635900", + 1588456799999, + "14047345.00150181", + 23532, + "708.69864400", + "6317114.24360466", + "0" + ], + [ + 1588456800000, + "8924.94000000", + "8939.99000000", + "8892.89000000", + "8933.54000000", + "1415.24647300", + 1588460399999, + "12615864.00930303", + 19440, + "735.10258800", + "6551829.91816930", + "0" + ], + [ + 1588460400000, + "8934.39000000", + "8985.00000000", + "8921.42000000", + "8972.05000000", + "2625.09971700", + 1588463999999, + "23534920.05580419", + 27842, + "1544.99226300", + "13850336.96513025", + "0" + ], + [ + 1588464000000, + "8972.58000000", + "9150.00000000", + "8937.00000000", + "9124.35000000", + "6939.42051400", + 1588467599999, + "62960429.25997720", + 66647, + "4030.65418200", + "36568169.58914269", + "0" + ], + [ + 1588467600000, + "9124.42000000", + "9200.00000000", + "9055.00000000", + "9115.52000000", + "7267.83552200", + 1588471199999, + "66442480.59755613", + 62285, + "3607.09769700", + "32977753.53957761", + "0" + ], + [ + 1588471200000, + "9116.22000000", + "9146.62000000", + "9072.36000000", + "9073.06000000", + "2868.09192700", + 1588474799999, + "26140954.96083626", + 25913, + "1444.70470600", + "13168642.25928982", + "0" + ], + [ + 1588474800000, + "9073.06000000", + "9160.00000000", + "9072.72000000", + "9132.95000000", + "2476.56374500", + 1588478399999, + "22593375.32142197", + 26179, + "1353.98275300", + "12351457.84055297", + "0" + ], + [ + 1588478400000, + "9133.25000000", + "9150.23000000", + "9105.17000000", + "9112.26000000", + "2238.48076500", + 1588481999999, + "20419552.79146951", + 24033, + "1227.86123300", + "11200643.96248328", + "0" + ], + [ + 1588482000000, + "9112.25000000", + "9130.56000000", + "9080.00000000", + "9096.21000000", + "2406.32948500", + 1588485599999, + "21904317.39541657", + 25915, + "1035.25689000", + "9424986.56762526", + "0" + ], + [ + 1588485600000, + "9096.02000000", + "9098.43000000", + "8911.35000000", + "9003.00000000", + "7405.55799100", + 1588489199999, + "66556157.64958991", + 54262, + "3687.95029000", + "33134496.34256978", + "0" + ], + [ + 1588489200000, + "9002.99000000", + "9031.35000000", + "8982.00000000", + "8990.75000000", + "2502.90814200", + 1588492799999, + "22545338.84965815", + 26122, + "1268.25337400", + "11425039.56616212", + "0" + ], + [ + 1588492800000, + "8990.75000000", + "9049.19000000", + "8966.22000000", + "9033.78000000", + "1967.08675400", + 1588496399999, + "17745288.20759469", + 23234, + "940.11823200", + "8482657.19215805", + "0" + ], + [ + 1588496400000, + "9033.74000000", + "9122.44000000", + "9027.00000000", + "9104.49000000", + "2859.83546300", + 1588499999999, + "25969732.61145590", + 30323, + "1612.84051500", + "14646994.86977828", + "0" + ], + [ + 1588500000000, + "9103.96000000", + "9140.00000000", + "8992.00000000", + "9041.46000000", + "3537.19325100", + 1588503599999, + "32075671.68321452", + 37218, + "1727.22727300", + "15668546.37901022", + "0" + ], + [ + 1588503600000, + "9040.90000000", + "9098.17000000", + "9019.99000000", + "9045.50000000", + "1827.21670800", + 1588507199999, + "16560987.41887577", + 23436, + "923.33732700", + "8369038.89770625", + "0" + ], + [ + 1588507200000, + "9045.62000000", + "9094.00000000", + "8853.00000000", + "8958.85000000", + "7371.05449400", + 1588510799999, + "66014751.09038685", + 62147, + "3211.92007300", + "28773403.57476987", + "0" + ], + [ + 1588510800000, + "8959.98000000", + "8960.00000000", + "8824.67000000", + "8920.82000000", + "7503.99207700", + 1588514399999, + "66694973.13563730", + 59279, + "3525.43844000", + "31336610.17335927", + "0" + ], + [ + 1588514400000, + "8920.83000000", + "8921.83000000", + "8727.00000000", + "8767.10000000", + "6800.46290500", + 1588517999999, + "60043243.26899746", + 56367, + "2747.83258900", + "24283081.92714683", + "0" + ], + [ + 1588518000000, + "8768.55000000", + "8843.00000000", + "8712.00000000", + "8813.00000000", + "5487.67937300", + 1588521599999, + "48231334.08885362", + 51020, + "2661.28146100", + "23384304.84238519", + "0" + ], + [ + 1588521600000, + "8812.78000000", + "8881.00000000", + "8781.49000000", + "8852.14000000", + "2971.24540300", + 1588525199999, + "26297081.93387406", + 31755, + "1439.72118500", + "12741766.35439565", + "0" + ], + [ + 1588525200000, + "8851.50000000", + "8887.00000000", + "8781.20000000", + "8818.29000000", + "2378.77551500", + 1588528799999, + "21024621.86490055", + 26300, + "1095.91813900", + "9691226.90944805", + "0" + ], + [ + 1588528800000, + "8818.29000000", + "8869.00000000", + "8802.00000000", + "8848.55000000", + "1517.45571600", + 1588532399999, + "13415840.90709471", + 19569, + "777.44961100", + "6873850.33817090", + "0" + ], + [ + 1588532400000, + "8848.35000000", + "8906.00000000", + "8843.76000000", + "8872.34000000", + "2289.33708000", + 1588535999999, + "20332847.83698922", + 25582, + "1271.19374200", + "11291030.71124655", + "0" + ], + [ + 1588536000000, + "8871.31000000", + "8883.97000000", + "8790.00000000", + "8843.55000000", + "2014.04101700", + 1588539599999, + "17797389.24759528", + 25784, + "892.76486200", + "7889610.24697644", + "0" + ], + [ + 1588539600000, + "8843.55000000", + "8908.61000000", + "8806.00000000", + "8856.00000000", + "1700.49225600", + 1588543199999, + "15057088.66619829", + 26341, + "891.80058100", + "7900243.12279509", + "0" + ], + [ + 1588543200000, + "8856.28000000", + "8955.00000000", + "8856.01000000", + "8895.70000000", + "3431.46108600", + 1588546799999, + "30601696.22080678", + 39130, + "1680.03785800", + "14985040.69969139", + "0" + ], + [ + 1588546800000, + "8896.08000000", + "8921.76000000", + "8851.56000000", + "8894.16000000", + "2363.54845400", + 1588550399999, + "21001940.92375842", + 28619, + "1266.72738700", + "11255845.89479565", + "0" + ], + [ + 1588550400000, + "8894.15000000", + "8936.10000000", + "8770.00000000", + "8806.18000000", + "4085.93199100", + 1588553999999, + "36162398.75938430", + 36434, + "1962.50715300", + "17376478.42955431", + "0" + ], + [ + 1588554000000, + "8806.22000000", + "8836.42000000", + "8630.55000000", + "8693.71000000", + "7862.14503500", + 1588557599999, + "68479222.58903878", + 66086, + "3061.16371700", + "26665965.27288821", + "0" + ], + [ + 1588557600000, + "8693.76000000", + "8780.41000000", + "8672.67000000", + "8746.70000000", + "2740.61042800", + 1588561199999, + "23947192.21864962", + 30312, + "1267.66415400", + "11078300.89633948", + "0" + ], + [ + 1588561200000, + "8746.70000000", + "8768.75000000", + "8701.00000000", + "8730.84000000", + "1761.36124200", + 1588564799999, + "15381972.43095304", + 20987, + "966.19937200", + "8438000.74648885", + "0" + ], + [ + 1588564800000, + "8730.85000000", + "8741.99000000", + "8621.00000000", + "8687.87000000", + "4059.23858600", + 1588568399999, + "35239679.01640431", + 38752, + "1889.20880900", + "16405684.25374498", + "0" + ], + [ + 1588568400000, + "8688.04000000", + "8695.95000000", + "8522.00000000", + "8606.11000000", + "7444.50769200", + 1588571999999, + "63981834.02828627", + 59470, + "3454.61425200", + "29693404.19255092", + "0" + ], + [ + 1588572000000, + "8606.11000000", + "8650.00000000", + "8582.17000000", + "8620.80000000", + "2867.26981600", + 1588575599999, + "24739352.27879510", + 28065, + "1395.29626500", + "12041508.96372869", + "0" + ], + [ + 1588575600000, + "8620.80000000", + "8669.00000000", + "8569.82000000", + "8648.41000000", + "3214.57869600", + 1588579199999, + "27722383.42018228", + 30634, + "1572.68342200", + "13570209.60834007", + "0" + ], + [ + 1588579200000, + "8648.42000000", + "8716.80000000", + "8638.68000000", + "8691.29000000", + "3560.96027300", + 1588582799999, + "30924178.49476042", + 37522, + "1656.58457300", + "14386238.45993478", + "0" + ], + [ + 1588582800000, + "8691.00000000", + "8696.88000000", + "8594.26000000", + "8630.54000000", + "3031.44179500", + 1588586399999, + "26197953.70888939", + 31923, + "1273.32972100", + "11006230.44535717", + "0" + ], + [ + 1588586400000, + "8630.55000000", + "8680.00000000", + "8602.00000000", + "8623.46000000", + "2678.67884100", + 1588589999999, + "23162591.56220275", + 30131, + "1441.02031300", + "12462358.68027016", + "0" + ], + [ + 1588590000000, + "8623.47000000", + "8697.65000000", + "8617.89000000", + "8672.36000000", + "2413.24500200", + 1588593599999, + "20903224.34153389", + 26488, + "1285.14435800", + "11132056.21673352", + "0" + ], + [ + 1588593600000, + "8672.57000000", + "8748.00000000", + "8646.52000000", + "8714.58000000", + "3652.09676800", + 1588597199999, + "31814568.16400064", + 38420, + "1755.15929300", + "15288661.22759409", + "0" + ], + [ + 1588597200000, + "8714.97000000", + "8836.00000000", + "8713.57000000", + "8829.48000000", + "4579.06183900", + 1588600799999, + "40152520.99590441", + 43134, + "2224.53030400", + "19506851.57645475", + "0" + ], + [ + 1588600800000, + "8828.35000000", + "8860.00000000", + "8776.06000000", + "8780.10000000", + "5029.11092700", + 1588604399999, + "44337537.62375647", + 46088, + "2155.64547800", + "19004316.65966703", + "0" + ], + [ + 1588604400000, + "8781.02000000", + "8849.19000000", + "8779.33000000", + "8848.00000000", + "2823.87742900", + 1588607999999, + "24895577.85888427", + 36099, + "1304.84893300", + "11505003.75223063", + "0" + ], + [ + 1588608000000, + "8848.00000000", + "8887.00000000", + "8789.00000000", + "8828.96000000", + "4115.99904100", + 1588611599999, + "36374829.06979872", + 44341, + "1611.69389900", + "14243808.28751838", + "0" + ], + [ + 1588611600000, + "8829.20000000", + "8848.13000000", + "8743.58000000", + "8799.54000000", + "3216.48605400", + 1588615199999, + "28271032.81019102", + 34448, + "1375.45745500", + "12087533.85496248", + "0" + ], + [ + 1588615200000, + "8799.54000000", + "8873.00000000", + "8790.00000000", + "8845.40000000", + "2388.20222200", + 1588618799999, + "21102498.57416183", + 26789, + "1110.57384600", + "9814977.96259083", + "0" + ], + [ + 1588618800000, + "8845.39000000", + "8881.80000000", + "8806.00000000", + "8830.14000000", + "2371.79855600", + 1588622399999, + "20981763.76862880", + 26704, + "1093.75307100", + "9675259.33703438", + "0" + ], + [ + 1588622400000, + "8828.94000000", + "8926.00000000", + "8828.07000000", + "8902.65000000", + "3024.35650200", + 1588625999999, + "26876102.88167019", + 33388, + "1658.89871400", + "14745555.35741581", + "0" + ], + [ + 1588626000000, + "8901.81000000", + "8942.38000000", + "8875.69000000", + "8936.71000000", + "2225.62624100", + 1588629599999, + "19834947.60217779", + 29139, + "1264.92491000", + "11274999.17178643", + "0" + ], + [ + 1588629600000, + "8936.56000000", + "8950.00000000", + "8844.37000000", + "8869.93000000", + "2786.35316900", + 1588633199999, + "24825833.88208937", + 27370, + "1192.49575700", + "10627139.44629731", + "0" + ], + [ + 1588633200000, + "8869.94000000", + "8904.00000000", + "8825.00000000", + "8871.96000000", + "2485.57418600", + 1588636799999, + "22034622.61358172", + 26078, + "1144.98245300", + "10149531.78053450", + "0" + ], + [ + 1588636800000, + "8871.92000000", + "8928.35000000", + "8840.68000000", + "8901.65000000", + "2320.63763600", + 1588640399999, + "20623182.89611974", + 25866, + "1059.85291300", + "9419262.98686501", + "0" + ], + [ + 1588640400000, + "8901.61000000", + "8902.99000000", + "8825.92000000", + "8879.58000000", + "1945.86556700", + 1588643999999, + "17246596.49083409", + 24787, + "903.53867600", + "8007163.88671690", + "0" + ], + [ + 1588644000000, + "8879.90000000", + "8886.63000000", + "8822.00000000", + "8853.75000000", + "1660.17273600", + 1588647599999, + "14694719.96537882", + 20504, + "789.55201600", + "6989401.95617167", + "0" + ], + [ + 1588647600000, + "8853.75000000", + "8874.87000000", + "8815.00000000", + "8850.00000000", + "1994.92165000", + 1588651199999, + "17650313.23533513", + 23486, + "1120.72866000", + "9916549.57562718", + "0" + ], + [ + 1588651200000, + "8850.00000000", + "9085.00000000", + "8849.97000000", + "9043.80000000", + "7260.64433800", + 1588654799999, + "65228547.01412902", + 57168, + "4024.64438400", + "36170157.32285984", + "0" + ], + [ + 1588654800000, + "9045.85000000", + "9118.58000000", + "8990.00000000", + "9006.45000000", + "6483.75982000", + 1588658399999, + "58692206.54082214", + 64292, + "3363.69593800", + "30454606.73040074", + "0" + ], + [ + 1588658400000, + "9007.26000000", + "9049.96000000", + "8958.00000000", + "9024.98000000", + "3257.05779900", + 1588661999999, + "29344562.45352013", + 37821, + "1737.88813500", + "15661514.11355990", + "0" + ], + [ + 1588662000000, + "9024.97000000", + "9068.95000000", + "8998.00000000", + "9013.55000000", + "3113.82356300", + 1588665599999, + "28136656.09638908", + 31896, + "1549.09143000", + "13997666.47990052", + "0" + ], + [ + 1588665600000, + "9013.66000000", + "9040.00000000", + "8976.36000000", + "9032.57000000", + "2600.65596800", + 1588669199999, + "23431431.13744945", + 32201, + "1268.95351900", + "11433871.19336601", + "0" + ], + [ + 1588669200000, + "9031.57000000", + "9085.00000000", + "8990.10000000", + "9000.01000000", + "3255.22525400", + 1588672799999, + "29399404.04922272", + 40544, + "1777.75534000", + "16062533.85871001", + "0" + ], + [ + 1588672800000, + "9000.02000000", + "9001.11000000", + "8760.00000000", + "8848.25000000", + "9664.13465300", + 1588676399999, + "85567654.57467724", + 80355, + "4141.17437900", + "36655076.72047132", + "0" + ], + [ + 1588676400000, + "8848.35000000", + "8890.95000000", + "8830.00000000", + "8844.73000000", + "2879.85556600", + 1588679999999, + "25532583.13421578", + 32946, + "1291.86606600", + "11454790.40969938", + "0" + ], + [ + 1588680000000, + "8845.64000000", + "8884.22000000", + "8806.12000000", + "8869.62000000", + "2773.77149300", + 1588683599999, + "24553882.69519124", + 29068, + "1230.31622000", + "10888658.19818828", + "0" + ], + [ + 1588683600000, + "8869.62000000", + "8950.00000000", + "8844.63000000", + "8920.00000000", + "3712.94792700", + 1588687199999, + "33067948.82889794", + 35239, + "1762.19764800", + "15690875.36610038", + "0" + ], + [ + 1588687200000, + "8920.00000000", + "8924.99000000", + "8811.00000000", + "8880.81000000", + "3251.36381000", + 1588690799999, + "28803245.97027026", + 36492, + "1553.20822500", + "13761182.10515810", + "0" + ], + [ + 1588690800000, + "8880.50000000", + "8882.99000000", + "8830.00000000", + "8842.34000000", + "2260.64589400", + 1588694399999, + "20020025.51501453", + 25742, + "1028.93644800", + "9112475.37310963", + "0" + ], + [ + 1588694400000, + "8842.72000000", + "8892.20000000", + "8818.41000000", + "8872.11000000", + "2389.02318600", + 1588697999999, + "21174826.76893409", + 28746, + "1128.75536000", + "10005891.18775607", + "0" + ], + [ + 1588698000000, + "8871.23000000", + "8933.00000000", + "8841.01000000", + "8869.44000000", + "2192.27719200", + 1588701599999, + "19475320.29372607", + 26554, + "1071.99999400", + "9525046.20215221", + "0" + ], + [ + 1588701600000, + "8869.79000000", + "8910.00000000", + "8851.57000000", + "8888.91000000", + "1474.01249500", + 1588705199999, + "13092704.90744220", + 18846, + "770.68853500", + "6845734.36189723", + "0" + ], + [ + 1588705200000, + "8888.01000000", + "8938.00000000", + "8873.22000000", + "8905.00000000", + "1917.56746200", + 1588708799999, + "17078677.52218825", + 22051, + "906.82315000", + "8076986.41612620", + "0" + ], + [ + 1588708800000, + "8905.01000000", + "8964.16000000", + "8898.67000000", + "8938.05000000", + "2134.07117400", + 1588712399999, + "19063328.45537727", + 26300, + "1105.17187600", + "9873023.94509883", + "0" + ], + [ + 1588712400000, + "8938.04000000", + "8999.00000000", + "8938.04000000", + "8960.85000000", + "2517.87829800", + 1588715999999, + "22596933.86725280", + 31458, + "1224.84845700", + "10993049.59193717", + "0" + ], + [ + 1588716000000, + "8960.85000000", + "8982.00000000", + "8887.00000000", + "8969.83000000", + "2330.59177800", + 1588719599999, + "20840105.89600347", + 29893, + "1144.68503500", + "10236161.55258266", + "0" + ], + [ + 1588719600000, + "8969.05000000", + "9044.00000000", + "8949.98000000", + "9021.83000000", + "3089.86008300", + 1588723199999, + "27768160.56958939", + 30288, + "1498.14597500", + "13469313.89839504", + "0" + ], + [ + 1588723200000, + "9021.36000000", + "9038.00000000", + "8906.21000000", + "8947.15000000", + "3185.37554300", + 1588726799999, + "28591925.25508420", + 36987, + "1578.63777800", + "14176273.07023154", + "0" + ], + [ + 1588726800000, + "8947.08000000", + "8992.64000000", + "8937.00000000", + "8979.90000000", + "1120.75570000", + 1588730399999, + "10050723.21337154", + 16650, + "589.43877300", + "5285560.62946108", + "0" + ], + [ + 1588730400000, + "8979.83000000", + "8980.00000000", + "8940.48000000", + "8971.07000000", + "1175.42879000", + 1588733999999, + "10530955.91592210", + 15517, + "608.23742400", + "5449594.05856650", + "0" + ], + [ + 1588734000000, + "8971.11000000", + "9069.00000000", + "8951.65000000", + "8979.73000000", + "4052.63761500", + 1588737599999, + "36523341.12096880", + 38298, + "2157.19483300", + "19445753.38697797", + "0" + ], + [ + 1588737600000, + "8979.74000000", + "9048.80000000", + "8960.69000000", + "8997.26000000", + "2465.86752900", + 1588741199999, + "22234757.44517155", + 30195, + "1167.36706400", + "10526224.73614284", + "0" + ], + [ + 1588741200000, + "8997.94000000", + "9039.00000000", + "8980.54000000", + "9007.92000000", + "2036.17498900", + 1588744799999, + "18353421.77753689", + 22616, + "1007.11462500", + "9078029.46048005", + "0" + ], + [ + 1588744800000, + "9007.82000000", + "9044.13000000", + "9000.00000000", + "9025.50000000", + "1905.69023900", + 1588748399999, + "17202392.69565852", + 25334, + "993.77892000", + "8972111.52455206", + "0" + ], + [ + 1588748400000, + "9025.50000000", + "9050.00000000", + "8992.32000000", + "9018.18000000", + "2509.85406800", + 1588751999999, + "22651985.45119937", + 28643, + "1234.44998400", + "11142758.71009732", + "0" + ], + [ + 1588752000000, + "9018.05000000", + "9097.98000000", + "8995.93000000", + "9040.72000000", + "5789.25238300", + 1588755599999, + "52405626.05345355", + 52529, + "2693.00330800", + "24383869.25657536", + "0" + ], + [ + 1588755600000, + "9040.72000000", + "9092.00000000", + "9035.00000000", + "9082.59000000", + "3261.85762100", + 1588759199999, + "29569496.09646476", + 30669, + "1325.42090600", + "12021039.69893336", + "0" + ], + [ + 1588759200000, + "9082.98000000", + "9287.99000000", + "9062.00000000", + "9227.21000000", + "17597.35753900", + 1588762799999, + "161859378.41787667", + 152891, + "9543.94118700", + "87739962.14815714", + "0" + ], + [ + 1588762800000, + "9227.51000000", + "9349.00000000", + "9192.01000000", + "9313.00000000", + "7971.37639700", + 1588766399999, + "73801144.07825782", + 70201, + "4329.05773000", + "40082955.05878217", + "0" + ], + [ + 1588766400000, + "9313.96000000", + "9380.00000000", + "9207.58000000", + "9224.98000000", + "8599.19624300", + 1588769999999, + "79862545.71228709", + 71175, + "4457.44522600", + "41410483.42470186", + "0" + ], + [ + 1588770000000, + "9224.99000000", + "9273.15000000", + "9125.00000000", + "9226.81000000", + "6755.29466100", + 1588773599999, + "62142486.09129697", + 57853, + "2879.10884400", + "26498018.89639748", + "0" + ], + [ + 1588773600000, + "9226.35000000", + "9249.23000000", + "9180.00000000", + "9230.00000000", + "4687.64392100", + 1588777199999, + "43219335.74195128", + 37030, + "1597.18747900", + "14725162.04774167", + "0" + ], + [ + 1588777200000, + "9229.76000000", + "9292.92000000", + "9214.99000000", + "9273.39000000", + "4282.31089600", + 1588780799999, + "39656300.99838172", + 40823, + "1993.04414600", + "18455598.81683723", + "0" + ], + [ + 1588780800000, + "9273.40000000", + "9315.23000000", + "9212.00000000", + "9266.61000000", + "4127.85346400", + 1588784399999, + "38248140.93359771", + 42096, + "1941.75124500", + "17993781.54920805", + "0" + ], + [ + 1588784400000, + "9266.60000000", + "9284.00000000", + "9224.33000000", + "9265.77000000", + "2745.47436000", + 1588787999999, + "25394571.49726618", + 26714, + "1147.60071700", + "10615983.01576371", + "0" + ], + [ + 1588788000000, + "9265.67000000", + "9265.75000000", + "9190.51000000", + "9234.58000000", + "2483.84848800", + 1588791599999, + "22921036.28084679", + 24512, + "1055.00999300", + "9736130.22282463", + "0" + ], + [ + 1588791600000, + "9234.58000000", + "9284.86000000", + "9222.00000000", + "9237.73000000", + "2074.66442900", + 1588795199999, + "19184436.73615404", + 24089, + "1038.39724900", + "9603660.81254511", + "0" + ], + [ + 1588795200000, + "9237.74000000", + "9251.33000000", + "9205.82000000", + "9236.23000000", + "1807.50088600", + 1588798799999, + "16683881.10900120", + 21402, + "718.16775200", + "6628641.63597970", + "0" + ], + [ + 1588798800000, + "9236.23000000", + "9287.82000000", + "9235.82000000", + "9276.99000000", + "1560.20120300", + 1588802399999, + "14456661.31237546", + 22552, + "751.22772900", + "6961492.97043690", + "0" + ], + [ + 1588802400000, + "9276.99000000", + "9375.00000000", + "9270.00000000", + "9357.09000000", + "4998.06965300", + 1588805999999, + "46593364.58260804", + 45544, + "2761.11404200", + "25742799.73507337", + "0" + ], + [ + 1588806000000, + "9355.31000000", + "9395.00000000", + "9079.00000000", + "9142.92000000", + "8731.61580300", + 1588809599999, + "80655599.94817514", + 73341, + "3622.09393900", + "33491771.69913608", + "0" + ], + [ + 1588809600000, + "9143.40000000", + "9208.00000000", + "9021.00000000", + "9183.70000000", + "7284.74563600", + 1588813199999, + "66526705.75046436", + 67385, + "3246.05421800", + "29657751.62837262", + "0" + ], + [ + 1588813200000, + "9183.71000000", + "9244.60000000", + "9183.71000000", + "9224.51000000", + "3096.91202600", + 1588816799999, + "28546015.84701778", + 35134, + "1281.65917900", + "11817125.23566032", + "0" + ], + [ + 1588816800000, + "9226.35000000", + "9374.93000000", + "9193.13000000", + "9330.88000000", + "4544.32709500", + 1588820399999, + "42257716.16018068", + 43580, + "2369.35992300", + "22031036.08586807", + "0" + ], + [ + 1588820400000, + "9331.78000000", + "9350.00000000", + "9252.04000000", + "9290.39000000", + "3609.50587600", + 1588823999999, + "33563015.71659785", + 30727, + "1886.78436500", + "17547233.83962642", + "0" + ], + [ + 1588824000000, + "9290.21000000", + "9323.51000000", + "9240.06000000", + "9276.57000000", + "2342.65640900", + 1588827599999, + "21754310.89908126", + 25345, + "1137.88186700", + "10570971.09756942", + "0" + ], + [ + 1588827600000, + "9276.97000000", + "9312.23000000", + "9230.90000000", + "9269.00000000", + "2404.06573300", + 1588831199999, + "22307868.19778378", + 23494, + "1208.13021200", + "11213162.88961733", + "0" + ], + [ + 1588831200000, + "9268.47000000", + "9304.00000000", + "9242.00000000", + "9251.83000000", + "1839.92905100", + 1588834799999, + "17066154.18199705", + 20674, + "815.75759400", + "7566565.15994785", + "0" + ], + [ + 1588834800000, + "9251.46000000", + "9315.00000000", + "9235.62000000", + "9309.92000000", + "2208.89708300", + 1588838399999, + "20505493.32213066", + 24931, + "1101.46098600", + "10227421.96728978", + "0" + ], + [ + 1588838400000, + "9308.56000000", + "9340.00000000", + "9273.01000000", + "9338.84000000", + "2484.51320400", + 1588841999999, + "23113355.16808740", + 26182, + "1223.06325100", + "11380073.32456976", + "0" + ], + [ + 1588842000000, + "9338.81000000", + "9338.81000000", + "9265.22000000", + "9312.99000000", + "2400.02190300", + 1588845599999, + "22320809.30686596", + 25837, + "970.32174700", + "9025185.15941418", + "0" + ], + [ + 1588845600000, + "9312.99000000", + "9323.00000000", + "9260.80000000", + "9290.48000000", + "2521.36203400", + 1588849199999, + "23420623.17971711", + 24200, + "1188.10253200", + "11036455.43956120", + "0" + ], + [ + 1588849200000, + "9290.49000000", + "9310.00000000", + "9247.10000000", + "9280.01000000", + "2238.19408200", + 1588852799999, + "20765751.97199096", + 22988, + "1091.80215300", + "10131631.56706621", + "0" + ], + [ + 1588852800000, + "9280.05000000", + "9374.93000000", + "9262.00000000", + "9368.96000000", + "4251.93668300", + 1588856399999, + "39651070.52919594", + 37237, + "2237.98406900", + "20875602.65473326", + "0" + ], + [ + 1588856400000, + "9368.96000000", + "9590.00000000", + "9304.00000000", + "9486.53000000", + "19832.82683400", + 1588859999999, + "187787376.35375315", + 128801, + "11258.21616200", + "106605097.20482196", + "0" + ], + [ + 1588860000000, + "9487.20000000", + "9537.00000000", + "9481.63000000", + "9496.49000000", + "5163.63890100", + 1588863599999, + "49105005.78355518", + 50000, + "2410.78716800", + "22927584.16486322", + "0" + ], + [ + 1588863600000, + "9496.45000000", + "9567.37000000", + "9350.00000000", + "9515.51000000", + "9212.30000900", + 1588867199999, + "87267275.56169037", + 69096, + "4265.78285800", + "40432291.58890155", + "0" + ], + [ + 1588867200000, + "9516.43000000", + "9634.74000000", + "9503.34000000", + "9631.03000000", + "7301.70421700", + 1588870799999, + "69855791.58983657", + 68168, + "3728.27229100", + "35676336.51857336", + "0" + ], + [ + 1588870800000, + "9631.01000000", + "9887.00000000", + "9628.63000000", + "9832.08000000", + "20738.43227200", + 1588874399999, + "202358463.34802602", + 151921, + "10972.86507300", + "107059368.45778450", + "0" + ], + [ + 1588874400000, + "9832.08000000", + "9855.11000000", + "9730.36000000", + "9793.47000000", + "7524.83268300", + 1588877999999, + "73761434.83913223", + 67995, + "3285.68449400", + "32207974.39040899", + "0" + ], + [ + 1588878000000, + "9793.62000000", + "9950.00000000", + "9724.97000000", + "9863.93000000", + "9718.13181800", + 1588881599999, + "96019179.44149481", + 81156, + "5088.21344300", + "50296899.98501084", + "0" + ], + [ + 1588881600000, + "9863.93000000", + "9895.02000000", + "9721.01000000", + "9797.34000000", + "6158.55791300", + 1588885199999, + "60465528.53792703", + 57360, + "2749.83547500", + "27003183.25132207", + "0" + ], + [ + 1588885200000, + "9795.74000000", + "9890.00000000", + "9750.10000000", + "9871.91000000", + "3573.54237200", + 1588888799999, + "35073656.34841968", + 41036, + "1756.94379300", + "17243872.30165306", + "0" + ], + [ + 1588888800000, + "9872.61000000", + "9930.00000000", + "9820.30000000", + "9892.80000000", + "3884.43351500", + 1588892399999, + "38365019.32652111", + 40249, + "2059.06848100", + "20336854.29910165", + "0" + ], + [ + 1588892400000, + "9893.04000000", + "10067.00000000", + "9854.45000000", + "9986.40000000", + "12819.14402900", + 1588895999999, + "127925840.64489734", + 91339, + "7268.16177800", + "72538299.98436670", + "0" + ], + [ + 1588896000000, + "9986.30000000", + "10035.96000000", + "9845.80000000", + "10019.82000000", + "7138.36812300", + 1588899599999, + "71070280.79045420", + 65132, + "3270.12873600", + "32567603.44243842", + "0" + ], + [ + 1588899600000, + "10017.86000000", + "10024.96000000", + "9925.00000000", + "9987.04000000", + "4315.42805900", + 1588903199999, + "43040050.70644622", + 41435, + "2032.36237600", + "20272021.30457716", + "0" + ], + [ + 1588903200000, + "9987.04000000", + "9991.00000000", + "9852.00000000", + "9899.52000000", + "4335.57898500", + 1588906799999, + "43009274.68603685", + 38088, + "1930.86552400", + "19149379.98483036", + "0" + ], + [ + 1588906800000, + "9898.49000000", + "9947.60000000", + "9822.50000000", + "9930.69000000", + "3787.76939400", + 1588910399999, + "37478126.51779572", + 34731, + "1595.20003100", + "15785038.25300996", + "0" + ], + [ + 1588910400000, + "9930.69000000", + "9933.94000000", + "9862.55000000", + "9907.37000000", + "2531.73310700", + 1588913999999, + "25062829.49308164", + 28242, + "1071.01692700", + "10605142.70533623", + "0" + ], + [ + 1588914000000, + "9907.36000000", + "9919.00000000", + "9805.00000000", + "9866.14000000", + "3597.72891000", + 1588917599999, + "35525780.18508355", + 37647, + "1486.09561600", + "14676958.86714918", + "0" + ], + [ + 1588917600000, + "9864.66000000", + "9869.18000000", + "9745.61000000", + "9766.68000000", + "6125.16392900", + 1588921199999, + "60049843.60954951", + 57864, + "2566.87814700", + "25174867.30208007", + "0" + ], + [ + 1588921200000, + "9765.85000000", + "9827.83000000", + "9705.00000000", + "9810.14000000", + "5886.25160300", + 1588924799999, + "57502061.03625673", + 53166, + "2943.48991800", + "28763396.91125746", + "0" + ], + [ + 1588924800000, + "9810.34000000", + "9900.00000000", + "9807.98000000", + "9859.90000000", + "3977.04895800", + 1588928399999, + "39187040.26305133", + 40334, + "2031.65390800", + "20019710.21763227", + "0" + ], + [ + 1588928400000, + "9859.77000000", + "9873.54000000", + "9813.28000000", + "9833.40000000", + "2493.86481100", + 1588931999999, + "24552102.30039631", + 27620, + "1090.65620400", + "10738433.89794254", + "0" + ], + [ + 1588932000000, + "9833.14000000", + "9964.99000000", + "9818.01000000", + "9953.09000000", + "4104.16219400", + 1588935599999, + "40621142.02909564", + 40390, + "2272.31338100", + "22495299.14726470", + "0" + ], + [ + 1588935600000, + "9952.83000000", + "9953.06000000", + "9874.00000000", + "9899.75000000", + "4083.55972000", + 1588939199999, + "40484128.33943188", + 44241, + "1982.13084600", + "19650782.77493424", + "0" + ], + [ + 1588939200000, + "9899.35000000", + "9925.00000000", + "9780.00000000", + "9829.12000000", + "5033.23080300", + 1588942799999, + "49584278.05455720", + 48180, + "2309.86770800", + "22757562.30427674", + "0" + ], + [ + 1588942800000, + "9829.01000000", + "9895.00000000", + "9817.00000000", + "9883.06000000", + "2350.52865900", + 1588946399999, + "23190499.88192345", + 27719, + "994.29351700", + "9810244.79593023", + "0" + ], + [ + 1588946400000, + "9883.06000000", + "9986.45000000", + "9866.23000000", + "9954.99000000", + "5297.75405100", + 1588949999999, + "52645412.59765806", + 45985, + "2741.41372800", + "27251095.58051906", + "0" + ], + [ + 1588950000000, + "9954.95000000", + "10006.98000000", + "9912.00000000", + "9941.21000000", + "7482.53099900", + 1588953599999, + "74646965.41529283", + 61635, + "3726.58696600", + "37189300.88608879", + "0" + ], + [ + 1588953600000, + "9942.07000000", + "9995.00000000", + "9913.59000000", + "9973.23000000", + "4318.83614300", + 1588957199999, + "43048490.67888414", + 44874, + "1810.32725200", + "18045371.81247657", + "0" + ], + [ + 1588957200000, + "9973.23000000", + "9979.94000000", + "9922.24000000", + "9962.92000000", + "3111.55751400", + 1588960799999, + "30958258.19291822", + 32812, + "1307.44252200", + "13009314.42184390", + "0" + ], + [ + 1588960800000, + "9963.62000000", + "9978.10000000", + "9866.88000000", + "9888.94000000", + "3068.52274500", + 1588964399999, + "30506903.15749189", + 28553, + "1308.35702200", + "13011290.99988051", + "0" + ], + [ + 1588964400000, + "9888.94000000", + "9963.93000000", + "9860.52000000", + "9945.99000000", + "2840.24402200", + 1588967999999, + "28192525.34654789", + 28830, + "1288.00491200", + "12784013.16284188", + "0" + ], + [ + 1588968000000, + "9946.00000000", + "9985.58000000", + "9922.71000000", + "9980.00000000", + "2176.14887000", + 1588971599999, + "21656705.98464896", + 23347, + "1085.21220400", + "10802295.76791220", + "0" + ], + [ + 1588971600000, + "9979.79000000", + "9998.48000000", + "9956.00000000", + "9996.00000000", + "1946.24799200", + 1588975199999, + "19417412.38340461", + 24692, + "1087.64182200", + "10853057.29892035", + "0" + ], + [ + 1588975200000, + "9995.39000000", + "10000.52000000", + "9845.00000000", + "9873.95000000", + "4272.19015300", + 1588978799999, + "42435410.13994458", + 42030, + "1740.08195000", + "17301211.41382190", + "0" + ], + [ + 1588978800000, + "9872.97000000", + "9920.36000000", + "9780.00000000", + "9800.01000000", + "6409.34665600", + 1588982399999, + "63140321.95052779", + 50269, + "2535.61637700", + "24987931.60590116", + "0" + ], + [ + 1588982400000, + "9800.02000000", + "9886.33000000", + "9728.46000000", + "9868.79000000", + "5362.46000000", + 1588985999999, + "52641225.73544505", + 44090, + "2177.19208700", + "21384204.70378874", + "0" + ], + [ + 1588986000000, + "9869.58000000", + "9914.25000000", + "9842.92000000", + "9853.06000000", + "2351.77230100", + 1588989599999, + "23248394.12213357", + 29423, + "1197.19039300", + "11836719.05168532", + "0" + ], + [ + 1588989600000, + "9853.06000000", + "9874.29000000", + "9825.53000000", + "9849.33000000", + "1888.20660200", + 1588993199999, + "18598822.05345564", + 22503, + "828.38941600", + "8160451.43941335", + "0" + ], + [ + 1588993200000, + "9849.33000000", + "9890.00000000", + "9849.33000000", + "9863.02000000", + "1402.04360200", + 1588996799999, + "13839134.68639624", + 18154, + "520.94135100", + "5142006.72420856", + "0" + ], + [ + 1588996800000, + "9863.02000000", + "9878.99000000", + "9780.05000000", + "9830.23000000", + "3295.47364500", + 1589000399999, + "32387024.38137504", + 38730, + "1675.86934100", + "16469131.06061223", + "0" + ], + [ + 1589000400000, + "9830.22000000", + "9840.16000000", + "9752.00000000", + "9830.02000000", + "2747.31258300", + 1589003999999, + "26934007.84150710", + 28783, + "1259.03159300", + "12342496.94642303", + "0" + ], + [ + 1589004000000, + "9830.07000000", + "9835.77000000", + "9600.00000000", + "9697.55000000", + "7006.41663000", + 1589007599999, + "68163906.36837651", + 54112, + "2685.70788000", + "26156074.42097945", + "0" + ], + [ + 1589007600000, + "9697.55000000", + "9741.13000000", + "9561.00000000", + "9592.77000000", + "7521.56618800", + 1589011199999, + "72626928.55920089", + 68574, + "3503.68701200", + "33842941.29420293", + "0" + ], + [ + 1589011200000, + "9594.70000000", + "9699.00000000", + "9590.70000000", + "9677.25000000", + "4134.20997300", + 1589014799999, + "39926482.33244829", + 42262, + "1916.44253700", + "18504818.51416794", + "0" + ], + [ + 1589014800000, + "9677.76000000", + "9718.97000000", + "9645.08000000", + "9693.25000000", + "3573.66073300", + 1589018399999, + "34619469.40959071", + 33898, + "1688.53061500", + "16353747.36189809", + "0" + ], + [ + 1589018400000, + "9693.26000000", + "9694.70000000", + "9560.00000000", + "9628.98000000", + "4134.91434200", + 1589021999999, + "39758862.20163878", + 39454, + "1796.28567400", + "17271273.72857806", + "0" + ], + [ + 1589022000000, + "9628.98000000", + "9659.51000000", + "9520.00000000", + "9638.85000000", + "5067.76005700", + 1589025599999, + "48577187.29441948", + 48204, + "2224.35803700", + "21325275.56325981", + "0" + ], + [ + 1589025600000, + "9638.85000000", + "9693.74000000", + "9600.60000000", + "9670.57000000", + "2960.25480800", + 1589029199999, + "28587712.80298060", + 35743, + "1478.50494000", + "14278589.54564637", + "0" + ], + [ + 1589029200000, + "9670.92000000", + "9718.00000000", + "9618.79000000", + "9717.99000000", + "2348.94315400", + 1589032799999, + "22717532.47638703", + 29519, + "1197.55011400", + "11583773.99868889", + "0" + ], + [ + 1589032800000, + "9717.99000000", + "9719.22000000", + "9665.00000000", + "9698.04000000", + "2447.02624400", + 1589036399999, + "23716495.39302933", + 30007, + "996.42229800", + "9657417.56267553", + "0" + ], + [ + 1589036400000, + "9699.23000000", + "9700.00000000", + "9627.03000000", + "9688.62000000", + "2745.32372100", + 1589039999999, + "26525110.16302323", + 28111, + "1211.43594200", + "11707146.56753253", + "0" + ], + [ + 1589040000000, + "9688.55000000", + "9777.48000000", + "9672.00000000", + "9758.84000000", + "3863.63007800", + 1589043599999, + "37616417.05150400", + 41369, + "1834.78323300", + "17864401.39844812", + "0" + ], + [ + 1589043600000, + "9759.00000000", + "9795.00000000", + "9728.00000000", + "9774.95000000", + "1801.05208600", + 1589047199999, + "17572434.38857588", + 23238, + "921.19107500", + "8988185.60005165", + "0" + ], + [ + 1589047200000, + "9774.98000000", + "9786.35000000", + "9721.00000000", + "9738.78000000", + "1904.61399000", + 1589050799999, + "18583125.50739436", + 23704, + "819.40625400", + "7994693.44476983", + "0" + ], + [ + 1589050800000, + "9738.78000000", + "9771.50000000", + "9730.00000000", + "9744.77000000", + "1369.87673200", + 1589054399999, + "13360007.82595822", + 19383, + "570.98655400", + "5568395.63568755", + "0" + ], + [ + 1589054400000, + "9745.11000000", + "9773.09000000", + "9600.00000000", + "9655.28000000", + "3709.35803500", + 1589057999999, + "35914623.14576076", + 35720, + "1660.10548900", + "16077153.82917837", + "0" + ], + [ + 1589058000000, + "9655.32000000", + "9666.58000000", + "9577.85000000", + "9613.13000000", + "3115.54129900", + 1589061599999, + "30000549.90059807", + 37439, + "1492.21664200", + "14373695.94688183", + "0" + ], + [ + 1589061600000, + "9611.68000000", + "9677.99000000", + "9563.00000000", + "9600.51000000", + "2834.33182000", + 1589065199999, + "27267169.23961491", + 30887, + "1321.35078700", + "12717648.51673961", + "0" + ], + [ + 1589065200000, + "9600.51000000", + "9634.45000000", + "9525.00000000", + "9539.40000000", + "4364.93094400", + 1589068799999, + "41818728.79888860", + 36077, + "1761.09998000", + "16875389.80340760", + "0" + ], + [ + 1589068800000, + "9539.10000000", + "9574.83000000", + "8117.00000000", + "8703.67000000", + "47255.76268500", + 1589072399999, + "413986385.96479720", + 327193, + "19709.37658000", + "172059033.42223167", + "0" + ], + [ + 1589072400000, + "8703.56000000", + "8775.00000000", + "8575.66000000", + "8712.01000000", + "12893.52287900", + 1589075999999, + "112138829.58612138", + 116894, + "5750.27413400", + "50023724.35149673", + "0" + ], + [ + 1589076000000, + "8712.00000000", + "8717.75000000", + "8635.82000000", + "8661.49000000", + "4905.99179400", + 1589079599999, + "42574678.62455894", + 49733, + "2249.72897700", + "19523873.72383189", + "0" + ], + [ + 1589079600000, + "8661.86000000", + "8673.00000000", + "8316.00000000", + "8622.78000000", + "10485.92841100", + 1589083199999, + "89739263.32804871", + 80889, + "5003.53818600", + "42866930.25867194", + "0" + ], + [ + 1589083200000, + "8622.73000000", + "8624.96000000", + "8470.30000000", + "8559.10000000", + "6870.56598800", + 1589086799999, + "58700732.83822112", + 61153, + "3199.50059600", + "27339578.33991891", + "0" + ], + [ + 1589086800000, + "8561.23000000", + "8657.32000000", + "8550.21000000", + "8621.06000000", + "4346.55987800", + 1589090399999, + "37442961.18300742", + 44966, + "2134.13908700", + "18383531.52578246", + "0" + ], + [ + 1589090400000, + "8621.15000000", + "8631.54000000", + "8554.67000000", + "8602.63000000", + "3211.21142900", + 1589093999999, + "27609976.48290155", + 33973, + "1363.47555700", + "11723986.77741475", + "0" + ], + [ + 1589094000000, + "8602.44000000", + "8835.00000000", + "8600.00000000", + "8812.28000000", + "7206.61173100", + 1589097599999, + "62975039.11963833", + 63593, + "3403.29057300", + "29743397.98771446", + "0" + ], + [ + 1589097600000, + "8812.27000000", + "8900.00000000", + "8773.40000000", + "8811.66000000", + "7530.48042200", + 1589101199999, + "66546530.09293697", + 60915, + "3772.33199700", + "33346217.05072391", + "0" + ], + [ + 1589101200000, + "8812.72000000", + "8850.00000000", + "8735.94000000", + "8749.73000000", + "3696.84128700", + 1589104799999, + "32562816.66906816", + 39971, + "1874.93424300", + "16511464.37332526", + "0" + ], + [ + 1589104800000, + "8751.50000000", + "8836.56000000", + "8665.83000000", + "8810.20000000", + "4721.31988200", + 1589108399999, + "41411789.86922589", + 45006, + "2546.18542000", + "22344299.18374492", + "0" + ], + [ + 1589108400000, + "8809.54000000", + "8815.25000000", + "8645.00000000", + "8737.35000000", + "4557.49658900", + 1589111999999, + "39748151.09058991", + 42431, + "2106.79614100", + "18372750.83384876", + "0" + ], + [ + 1589112000000, + "8736.57000000", + "8775.00000000", + "8685.00000000", + "8717.18000000", + "3014.99079400", + 1589115599999, + "26355711.08111771", + 32310, + "1252.71595000", + "10945606.96727991", + "0" + ], + [ + 1589115600000, + "8716.68000000", + "8817.00000000", + "8690.18000000", + "8771.00000000", + "2809.84584200", + 1589119199999, + "24631023.40458613", + 33390, + "1461.26104000", + "12812021.80153470", + "0" + ], + [ + 1589119200000, + "8771.01000000", + "8789.76000000", + "8600.95000000", + "8659.82000000", + "4012.82764900", + 1589122799999, + "34946382.35499059", + 37975, + "1766.14230200", + "15375254.17510396", + "0" + ], + [ + 1589122800000, + "8659.81000000", + "8716.45000000", + "8560.00000000", + "8650.96000000", + "5621.31046600", + 1589126399999, + "48614822.22661378", + 52349, + "2499.57080700", + "21620527.39775484", + "0" + ], + [ + 1589126400000, + "8652.27000000", + "8686.87000000", + "8255.00000000", + "8270.00000000", + "13476.33284800", + 1589129999999, + "114353934.77335074", + 101404, + "5379.25251700", + "45668454.97261334", + "0" + ], + [ + 1589130000000, + "8270.00000000", + "8548.44000000", + "8265.75000000", + "8527.85000000", + "8666.10994800", + 1589133599999, + "73263420.38930499", + 72206, + "4377.65124400", + "37013132.13272461", + "0" + ], + [ + 1589133600000, + "8527.85000000", + "8569.69000000", + "8421.17000000", + "8487.43000000", + "4644.60609300", + 1589137199999, + "39466355.53281959", + 44579, + "2391.06494900", + "20310532.85921171", + "0" + ], + [ + 1589137200000, + "8487.43000000", + "8564.78000000", + "8483.20000000", + "8502.94000000", + "2886.07884400", + 1589140799999, + "24599171.59585984", + 32467, + "1406.42350400", + "11989622.33112134", + "0" + ], + [ + 1589140800000, + "8500.66000000", + "8784.66000000", + "8500.66000000", + "8663.94000000", + "7868.34574600", + 1589144399999, + "68461782.58771485", + 67789, + "4220.68210100", + "36718435.91672388", + "0" + ], + [ + 1589144400000, + "8663.85000000", + "8783.13000000", + "8662.43000000", + "8717.94000000", + "2808.19807900", + 1589147999999, + "24490414.21623225", + 36133, + "1372.76420900", + "11972328.09855610", + "0" + ], + [ + 1589148000000, + "8717.55000000", + "8799.08000000", + "8685.00000000", + "8777.99000000", + "2699.54407300", + 1589151599999, + "23599475.34826884", + 30285, + "1447.55931300", + "12658172.01420784", + "0" + ], + [ + 1589151600000, + "8778.00000000", + "8837.28000000", + "8540.41000000", + "8722.77000000", + "7674.69867100", + 1589155199999, + "66776828.61566207", + 58167, + "3687.92134700", + "32094783.85645725", + "0" + ], + [ + 1589155200000, + "8722.77000000", + "8805.14000000", + "8696.00000000", + "8770.16000000", + "3812.84291300", + 1589158799999, + "33401526.41072163", + 35578, + "1827.00428000", + "16007690.65814010", + "0" + ], + [ + 1589158800000, + "8770.15000000", + "8775.00000000", + "8684.90000000", + "8713.41000000", + "2206.72970100", + 1589162399999, + "19257712.50089768", + 23376, + "1105.55841400", + "9646749.01939481", + "0" + ], + [ + 1589162400000, + "8711.93000000", + "8761.18000000", + "8690.00000000", + "8748.07000000", + "1879.77145100", + 1589165999999, + "16420686.63574517", + 18060, + "1009.09446200", + "8817080.22405216", + "0" + ], + [ + 1589166000000, + "8747.18000000", + "8768.00000000", + "8658.56000000", + "8696.64000000", + "2742.31442100", + 1589169599999, + "23873709.84705820", + 26528, + "1271.92134800", + "11068720.76507168", + "0" + ], + [ + 1589169600000, + "8696.24000000", + "8710.76000000", + "8620.00000000", + "8634.53000000", + "2670.66075200", + 1589173199999, + "23158687.09171903", + 24181, + "1206.25638600", + "10460979.78071471", + "0" + ], + [ + 1589173200000, + "8633.59000000", + "8702.39000000", + "8613.01000000", + "8689.26000000", + "2403.74851000", + 1589176799999, + "20812516.53826217", + 23306, + "1216.92670500", + "10534882.68812182", + "0" + ], + [ + 1589176800000, + "8689.26000000", + "8732.23000000", + "8666.66000000", + "8684.34000000", + "2375.45963600", + 1589180399999, + "20659724.24312470", + 21127, + "1126.67530400", + "9799658.91130842", + "0" + ], + [ + 1589180400000, + "8684.68000000", + "8706.00000000", + "8625.00000000", + "8664.32000000", + "2877.01962200", + 1589183999999, + "24935511.46465560", + 26320, + "1211.82622900", + "10503406.12158519", + "0" + ], + [ + 1589184000000, + "8664.32000000", + "8685.00000000", + "8566.01000000", + "8636.07000000", + "3748.90216300", + 1589187599999, + "32312229.07623073", + 33686, + "1809.03936400", + "15591407.33043310", + "0" + ], + [ + 1589187600000, + "8635.84000000", + "8638.43000000", + "8478.00000000", + "8487.10000000", + "5554.12043700", + 1589191199999, + "47502271.73766481", + 44012, + "2532.64680300", + "21660442.00569237", + "0" + ], + [ + 1589191200000, + "8487.11000000", + "8885.00000000", + "8484.50000000", + "8803.07000000", + "11097.65426100", + 1589194799999, + "96834422.31729213", + 82567, + "5656.39089000", + "49371427.46225448", + "0" + ], + [ + 1589194800000, + "8803.07000000", + "8990.00000000", + "8746.00000000", + "8927.43000000", + "8654.21814400", + 1589198399999, + "76794755.91901057", + 69974, + "4418.37630700", + "39219939.46919102", + "0" + ], + [ + 1589198400000, + "8926.17000000", + "9168.00000000", + "8725.35000000", + "8856.34000000", + "22921.02167300", + 1589201999999, + "206428036.20821366", + 149765, + "10978.61672700", + "98928090.74468328", + "0" + ], + [ + 1589202000000, + "8856.35000000", + "8968.00000000", + "8754.00000000", + "8846.12000000", + "8487.80437000", + 1589205599999, + "75207417.28453592", + 71906, + "3849.50216200", + "34116156.34613253", + "0" + ], + [ + 1589205600000, + "8847.67000000", + "8942.72000000", + "8839.55000000", + "8871.89000000", + "5286.75835000", + 1589209199999, + "46998413.21900639", + 46049, + "2344.46593700", + "20841626.16797394", + "0" + ], + [ + 1589209200000, + "8871.57000000", + "8956.01000000", + "8812.14000000", + "8882.96000000", + "5057.33658800", + 1589212799999, + "45002621.84615145", + 43350, + "2371.87301300", + "21113917.70933216", + "0" + ], + [ + 1589212800000, + "8882.97000000", + "8924.48000000", + "8325.00000000", + "8604.34000000", + "16482.06073900", + 1589216399999, + "142091032.05873477", + 115237, + "7598.98041600", + "65498705.72801638", + "0" + ], + [ + 1589216400000, + "8604.34000000", + "8672.83000000", + "8425.05000000", + "8506.76000000", + "11005.55835500", + 1589219999999, + "94230561.75070875", + 83542, + "5465.76777600", + "46814222.96191677", + "0" + ], + [ + 1589220000000, + "8503.55000000", + "8660.00000000", + "8200.00000000", + "8605.35000000", + "19287.07916100", + 1589223599999, + "162222033.43474820", + 142323, + "9162.06872200", + "77156313.87301007", + "0" + ], + [ + 1589223600000, + "8604.20000000", + "8780.00000000", + "8420.07000000", + "8746.86000000", + "12480.47910300", + 1589227199999, + "106925042.44648130", + 102580, + "6539.34474800", + "56096454.01435744", + "0" + ], + [ + 1589227200000, + "8745.25000000", + "8807.00000000", + "8563.94000000", + "8630.16000000", + "8005.84579300", + 1589230799999, + "69505188.56459548", + 69670, + "4091.91124500", + "35525000.92780819", + "0" + ], + [ + 1589230800000, + "8630.36000000", + "8700.00000000", + "8459.28000000", + "8589.84000000", + "3845.10869400", + 1589234399999, + "32980032.29609837", + 48826, + "1702.28143300", + "14616847.57508724", + "0" + ], + [ + 1589234400000, + "8589.84000000", + "8647.35000000", + "8519.92000000", + "8601.37000000", + "2931.68379900", + 1589237999999, + "25188808.11921036", + 33977, + "1528.58633700", + "13139510.74721647", + "0" + ], + [ + 1589238000000, + "8600.66000000", + "8640.31000000", + "8500.00000000", + "8561.52000000", + "2993.07319600", + 1589241599999, + "25649879.74993652", + 31442, + "1449.48005900", + "12429712.92716446", + "0" + ], + [ + 1589241600000, + "8562.04000000", + "8678.55000000", + "8528.78000000", + "8611.33000000", + "3183.63398800", + 1589245199999, + "27410029.87651289", + 33794, + "1431.54617200", + "12329786.70655874", + "0" + ], + [ + 1589245200000, + "8611.34000000", + "8644.00000000", + "8563.87000000", + "8619.50000000", + "2378.22196500", + 1589248799999, + "20457864.12008659", + 24295, + "1005.73929500", + "8652071.88999803", + "0" + ], + [ + 1589248800000, + "8619.96000000", + "8685.71000000", + "8592.00000000", + "8637.51000000", + "2505.34626700", + 1589252399999, + "21634718.26092551", + 25198, + "1079.25943000", + "9320414.77890373", + "0" + ], + [ + 1589252400000, + "8637.05000000", + "8742.43000000", + "8632.51000000", + "8716.07000000", + "3157.72300200", + 1589255999999, + "27461493.03245129", + 29355, + "1376.46711300", + "11971975.31249547", + "0" + ], + [ + 1589256000000, + "8716.75000000", + "8750.01000000", + "8664.28000000", + "8702.57000000", + "2719.18265300", + 1589259599999, + "23685669.73259698", + 25561, + "1321.54529600", + "11513591.52042406", + "0" + ], + [ + 1589259600000, + "8702.13000000", + "8785.00000000", + "8702.13000000", + "8730.75000000", + "2657.78307700", + 1589263199999, + "23250893.28443685", + 28908, + "1214.14421800", + "10622502.03814938", + "0" + ], + [ + 1589263200000, + "8730.75000000", + "8764.01000000", + "8652.46000000", + "8704.75000000", + "2762.88348100", + 1589266799999, + "24032357.56752938", + 28185, + "1480.75136300", + "12876696.09802750", + "0" + ], + [ + 1589266800000, + "8704.16000000", + "8719.96000000", + "8614.98000000", + "8656.05000000", + "2808.94255000", + 1589270399999, + "24318757.00388900", + 26665, + "1257.60572700", + "10888297.84259907", + "0" + ], + [ + 1589270400000, + "8655.76000000", + "8764.93000000", + "8632.93000000", + "8749.75000000", + "4017.49231600", + 1589273999999, + "35061335.29865338", + 34261, + "1881.78611400", + "16421408.68230443", + "0" + ], + [ + 1589274000000, + "8748.82000000", + "8828.72000000", + "8743.08000000", + "8785.84000000", + "4891.21706800", + 1589277599999, + "42982148.24579899", + 39749, + "2338.35618000", + "20549918.93875760", + "0" + ], + [ + 1589277600000, + "8785.84000000", + "8820.00000000", + "8725.52000000", + "8778.21000000", + "3434.03330800", + 1589281199999, + "30112728.47000371", + 32510, + "1676.38600700", + "14701126.93083098", + "0" + ], + [ + 1589281200000, + "8778.21000000", + "8812.00000000", + "8726.00000000", + "8800.92000000", + "2503.95207500", + 1589284799999, + "21941910.17037866", + 27832, + "1250.01847500", + "10954964.50535911", + "0" + ], + [ + 1589284800000, + "8800.91000000", + "8819.00000000", + "8735.42000000", + "8769.49000000", + "2783.75223000", + 1589288399999, + "24407070.07314274", + 27535, + "1455.69165600", + "12767042.96190589", + "0" + ], + [ + 1589288400000, + "8769.74000000", + "8780.00000000", + "8659.00000000", + "8730.01000000", + "4561.43869500", + 1589291999999, + "39788775.00042232", + 38953, + "1970.72933000", + "17186026.65450628", + "0" + ], + [ + 1589292000000, + "8730.02000000", + "8917.72000000", + "8730.01000000", + "8887.26000000", + "9344.07555200", + 1589295599999, + "82727662.79928705", + 64333, + "4821.74567700", + "42681804.45011767", + "0" + ], + [ + 1589295600000, + "8887.21000000", + "8944.72000000", + "8846.00000000", + "8867.72000000", + "5862.04603300", + 1589299199999, + "52135141.33061803", + 46355, + "2559.89241000", + "22769849.06252116", + "0" + ], + [ + 1589299200000, + "8867.72000000", + "8953.33000000", + "8865.79000000", + "8923.82000000", + "4768.86154700", + 1589302799999, + "42526987.23079953", + 38593, + "2246.06214900", + "20027973.00118362", + "0" + ], + [ + 1589302800000, + "8923.82000000", + "8978.26000000", + "8792.74000000", + "8879.00000000", + "5374.98263700", + 1589306399999, + "47883223.54743068", + 43708, + "2557.26748700", + "22789228.90085335", + "0" + ], + [ + 1589306400000, + "8879.00000000", + "8911.00000000", + "8835.00000000", + "8897.89000000", + "2869.55523800", + 1589309999999, + "25477534.95597536", + 28017, + "1173.54137700", + "10418139.75556752", + "0" + ], + [ + 1589310000000, + "8897.89000000", + "8925.98000000", + "8775.00000000", + "8792.19000000", + "3992.54634400", + 1589313599999, + "35370861.36412929", + 35841, + "1768.11868200", + "15660396.95014849", + "0" + ], + [ + 1589313600000, + "8792.19000000", + "8844.16000000", + "8765.00000000", + "8815.27000000", + "3620.55475500", + 1589317199999, + "31877739.02829114", + 30954, + "1736.28451100", + "15288805.43561398", + "0" + ], + [ + 1589317200000, + "8815.02000000", + "8851.92000000", + "8730.06000000", + "8779.99000000", + "2488.89638800", + 1589320799999, + "21891239.74630732", + 31689, + "1163.27059900", + "10235222.72244403", + "0" + ], + [ + 1589320800000, + "8779.99000000", + "8831.06000000", + "8740.00000000", + "8812.90000000", + "2331.38659500", + 1589324399999, + "20504354.71027237", + 24142, + "1141.12995900", + "10038187.15653575", + "0" + ], + [ + 1589324400000, + "8812.03000000", + "8842.40000000", + "8779.99000000", + "8810.79000000", + "1504.27230200", + 1589327999999, + "13254962.20101957", + 18426, + "662.97817400", + "5842581.89266177", + "0" + ], + [ + 1589328000000, + "8810.99000000", + "8939.00000000", + "8792.99000000", + "8934.03000000", + "4624.74429600", + 1589331599999, + "41168077.22568387", + 36846, + "2431.49291800", + "21646159.88025171", + "0" + ], + [ + 1589331600000, + "8934.04000000", + "8955.92000000", + "8891.11000000", + "8946.16000000", + "2549.96398800", + 1589335199999, + "22758680.24316937", + 22722, + "906.60265200", + "8092755.40148134", + "0" + ], + [ + 1589335200000, + "8946.16000000", + "8972.46000000", + "8886.12000000", + "8936.50000000", + "2399.89841500", + 1589338799999, + "21435597.77651852", + 23973, + "962.87600900", + "8602290.94798858", + "0" + ], + [ + 1589338800000, + "8936.50000000", + "8946.52000000", + "8890.80000000", + "8912.19000000", + "1941.85935300", + 1589342399999, + "17321716.09493712", + 18324, + "747.24624500", + "6665238.23946658", + "0" + ], + [ + 1589342400000, + "8911.99000000", + "8940.00000000", + "8869.32000000", + "8930.57000000", + "2178.18901400", + 1589345999999, + "19389147.82483635", + 24785, + "976.74691400", + "8696809.00023938", + "0" + ], + [ + 1589346000000, + "8930.57000000", + "8940.58000000", + "8867.63000000", + "8883.29000000", + "1924.93976000", + 1589349599999, + "17139362.44944262", + 20063, + "781.07115600", + "6955420.48563978", + "0" + ], + [ + 1589349600000, + "8883.29000000", + "8920.00000000", + "8866.71000000", + "8912.43000000", + "1955.36675900", + 1589353199999, + "17403113.59028980", + 20176, + "1102.12059700", + "9809742.69162225", + "0" + ], + [ + 1589353200000, + "8912.69000000", + "8920.00000000", + "8859.25000000", + "8867.20000000", + "1926.50290200", + 1589356799999, + "17117430.23053204", + 21913, + "819.81684800", + "7282817.71800112", + "0" + ], + [ + 1589356800000, + "8867.20000000", + "8917.00000000", + "8826.72000000", + "8908.18000000", + "2977.05469700", + 1589360399999, + "26407295.20247288", + 31994, + "1426.78605000", + "12659124.49285552", + "0" + ], + [ + 1589360400000, + "8908.86000000", + "8933.25000000", + "8891.27000000", + "8914.22000000", + "2284.98422400", + 1589363999999, + "20369156.48010550", + 26590, + "1103.57981600", + "9839724.15025501", + "0" + ], + [ + 1589364000000, + "8914.22000000", + "8960.00000000", + "8896.06000000", + "8948.05000000", + "3299.57942900", + 1589367599999, + "29445866.19617212", + 28793, + "1191.02199200", + "10634394.89892525", + "0" + ], + [ + 1589367600000, + "8949.70000000", + "9048.62000000", + "8928.00000000", + "9035.98000000", + "5404.60214400", + 1589371199999, + "48560945.98580147", + 51615, + "2854.53731400", + "25651132.69662045", + "0" + ], + [ + 1589371200000, + "9036.38000000", + "9099.22000000", + "8982.75000000", + "9089.30000000", + "5570.47413700", + 1589374799999, + "50388133.00043390", + 51916, + "2676.79940600", + "24216267.73816689", + "0" + ], + [ + 1589374800000, + "9089.30000000", + "9115.88000000", + "9032.86000000", + "9080.06000000", + "5384.46317900", + 1589378399999, + "48887597.19450042", + 45291, + "2496.48178400", + "22670715.38097991", + "0" + ], + [ + 1589378400000, + "9080.57000000", + "9135.00000000", + "9035.93000000", + "9082.26000000", + "6051.84267700", + 1589381999999, + "55037918.43890368", + 48935, + "2684.20579300", + "24416241.13951535", + "0" + ], + [ + 1589382000000, + "9082.25000000", + "9188.00000000", + "9081.57000000", + "9136.85000000", + "6147.68884300", + 1589385599999, + "56131331.54665987", + 49180, + "2929.94210100", + "26756601.48211516", + "0" + ], + [ + 1589385600000, + "9136.85000000", + "9165.73000000", + "9036.20000000", + "9111.20000000", + "5041.36232400", + 1589389199999, + "45887521.81048709", + 44299, + "2135.09645700", + "19438821.16001910", + "0" + ], + [ + 1589389200000, + "9111.02000000", + "9115.00000000", + "9050.01000000", + "9085.27000000", + "2612.47921700", + 1589392799999, + "23709893.00643579", + 28856, + "1221.50509600", + "11085607.23265805", + "0" + ], + [ + 1589392800000, + "9085.28000000", + "9108.55000000", + "9070.16000000", + "9077.16000000", + "2122.05844300", + 1589396399999, + "19290604.15764962", + 24781, + "783.97941400", + "7127089.34118808", + "0" + ], + [ + 1589396400000, + "9077.60000000", + "9160.00000000", + "9069.29000000", + "9151.24000000", + "3189.84779700", + 1589399999999, + "29084301.65145108", + 28239, + "1614.98410900", + "14729197.99384451", + "0" + ], + [ + 1589400000000, + "9151.25000000", + "9330.00000000", + "9136.75000000", + "9285.92000000", + "9104.65325800", + 1589403599999, + "84289163.78481695", + 82899, + "5189.31398500", + "48037667.91871649", + "0" + ], + [ + 1589403600000, + "9285.00000000", + "9398.00000000", + "9252.00000000", + "9347.12000000", + "7785.06444300", + 1589407199999, + "72736557.30928606", + 78410, + "4092.64602300", + "38238144.23280923", + "0" + ], + [ + 1589407200000, + "9347.52000000", + "9363.96000000", + "9265.00000000", + "9318.51000000", + "3482.15085000", + 1589410799999, + "32413947.19317490", + 34127, + "1440.09799100", + "13404228.57634689", + "0" + ], + [ + 1589410800000, + "9317.10000000", + "9349.00000000", + "9289.98000000", + "9309.37000000", + "2506.50386900", + 1589414399999, + "23352361.56644664", + 24489, + "1079.40398500", + "10057777.24462475", + "0" + ], + [ + 1589414400000, + "9309.35000000", + "9386.62000000", + "9285.00000000", + "9297.01000000", + "3441.30016900", + 1589417999999, + "32123260.72159579", + 33425, + "1426.98233700", + "13318623.08046268", + "0" + ], + [ + 1589418000000, + "9297.55000000", + "9328.62000000", + "9262.94000000", + "9270.62000000", + "2377.47150500", + 1589421599999, + "22098103.34853004", + 24078, + "898.96296500", + "8355274.40361059", + "0" + ], + [ + 1589421600000, + "9270.62000000", + "9340.00000000", + "9256.76000000", + "9334.01000000", + "2011.32912500", + 1589425199999, + "18706711.35003497", + 20971, + "874.58281600", + "8135335.43291894", + "0" + ], + [ + 1589425200000, + "9335.24000000", + "9359.37000000", + "9300.70000000", + "9352.38000000", + "2083.76949800", + 1589428799999, + "19448439.26918220", + 21062, + "852.11980300", + "7952850.02779505", + "0" + ], + [ + 1589428800000, + "9352.38000000", + "9356.63000000", + "9299.39000000", + "9318.69000000", + "1742.43260300", + 1589432399999, + "16245529.97077707", + 18262, + "659.12225700", + "6145319.40468998", + "0" + ], + [ + 1589432400000, + "9318.15000000", + "9447.00000000", + "9267.00000000", + "9437.77000000", + "5244.29364500", + 1589435999999, + "49101344.40149310", + 48832, + "2907.43805800", + "27230470.69717007", + "0" + ], + [ + 1589436000000, + "9438.76000000", + "9480.00000000", + "9403.35000000", + "9443.43000000", + "4805.86914400", + 1589439599999, + "45366631.82666884", + 47624, + "1897.23598000", + "17916050.61980621", + "0" + ], + [ + 1589439600000, + "9443.77000000", + "9547.00000000", + "9410.00000000", + "9508.56000000", + "6078.51165400", + 1589443199999, + "57713922.12075310", + 54731, + "3074.51037600", + "29202166.31767862", + "0" + ], + [ + 1589443200000, + "9508.56000000", + "9648.29000000", + "9467.50000000", + "9610.00000000", + "7244.43957600", + 1589446799999, + "69213653.22904222", + 65139, + "4039.94931900", + "38605109.07012533", + "0" + ], + [ + 1589446800000, + "9610.01000000", + "9828.99000000", + "9609.00000000", + "9803.54000000", + "12635.85928700", + 1589450399999, + "122776086.69326614", + 101018, + "7157.14767100", + "69539709.41442195", + "0" + ], + [ + 1589450400000, + "9803.44000000", + "9939.00000000", + "9516.00000000", + "9648.24000000", + "20034.14868500", + 1589453999999, + "195048802.61050516", + 153375, + "10056.12060300", + "98007713.58442128", + "0" + ], + [ + 1589454000000, + "9649.00000000", + "9799.13000000", + "9646.50000000", + "9686.71000000", + "7447.63698600", + 1589457599999, + "72402199.89426041", + 58934, + "3636.09453000", + "35355335.60985611", + "0" + ], + [ + 1589457600000, + "9686.71000000", + "9713.77000000", + "9551.64000000", + "9586.00000000", + "7284.97672900", + 1589461199999, + "70030205.97893197", + 65640, + "3667.67879400", + "35250540.19238318", + "0" + ], + [ + 1589461200000, + "9585.86000000", + "9649.00000000", + "9541.01000000", + "9622.71000000", + "4180.06786500", + 1589464799999, + "40127211.18688103", + 43781, + "2078.98152400", + "19957407.43450224", + "0" + ], + [ + 1589464800000, + "9622.88000000", + "9759.99000000", + "9605.00000000", + "9704.00000000", + "6136.51658900", + 1589468399999, + "59572065.29344995", + 56802, + "2622.15032500", + "25449918.05917235", + "0" + ], + [ + 1589468400000, + "9704.00000000", + "9758.00000000", + "9665.47000000", + "9748.98000000", + "3278.15235700", + 1589471999999, + "31851942.17287734", + 37173, + "1547.08519100", + "15036264.29798729", + "0" + ], + [ + 1589472000000, + "9748.99000000", + "9783.01000000", + "9592.00000000", + "9675.55000000", + "5484.33868200", + 1589475599999, + "53049791.30881060", + 52783, + "2445.83688200", + "23653601.57251611", + "0" + ], + [ + 1589475600000, + "9675.55000000", + "9675.55000000", + "9569.47000000", + "9621.81000000", + "3006.75258800", + 1589479199999, + "28927549.89200452", + 32174, + "1249.54219100", + "12023563.13167103", + "0" + ], + [ + 1589479200000, + "9621.93000000", + "9683.44000000", + "9586.00000000", + "9677.21000000", + "2340.77428900", + 1589482799999, + "22562393.71092407", + 31196, + "1140.44030900", + "10994701.25389575", + "0" + ], + [ + 1589482800000, + "9677.97000000", + "9723.04000000", + "9650.31000000", + "9660.00000000", + "2909.27253300", + 1589486399999, + "28210422.58341583", + 35441, + "1483.71260400", + "14388847.97343027", + "0" + ], + [ + 1589486400000, + "9658.59000000", + "9874.30000000", + "9599.84000000", + "9655.88000000", + "9265.76606600", + 1589489999999, + "90074575.72650963", + 84070, + "4694.02520500", + "45684009.06730827", + "0" + ], + [ + 1589490000000, + "9656.34000000", + "9780.18000000", + "9612.20000000", + "9774.98000000", + "3221.82445700", + 1589493599999, + "31268376.90746023", + 40892, + "1453.10595300", + "14103588.45062726", + "0" + ], + [ + 1589493600000, + "9775.24000000", + "9818.74000000", + "9714.41000000", + "9750.94000000", + "3410.96828600", + 1589497199999, + "33325958.75255086", + 37535, + "1541.27588800", + "15060205.48918080", + "0" + ], + [ + 1589497200000, + "9751.43000000", + "9850.32000000", + "9735.00000000", + "9791.98000000", + "3898.90515200", + 1589500799999, + "38211618.86374118", + 34592, + "2034.40941200", + "19947329.80569222", + "0" + ], + [ + 1589500800000, + "9791.97000000", + "9845.62000000", + "9710.13000000", + "9770.29000000", + "3485.15974800", + 1589504399999, + "34052563.87849883", + 35428, + "1708.04791300", + "16691479.76116060", + "0" + ], + [ + 1589504400000, + "9769.57000000", + "9775.52000000", + "9720.09000000", + "9738.79000000", + "1782.47961600", + 1589507999999, + "17379391.45154784", + 20487, + "875.71840900", + "8539092.33004305", + "0" + ], + [ + 1589508000000, + "9738.78000000", + "9748.51000000", + "9256.12000000", + "9490.21000000", + "15433.52661700", + 1589511599999, + "146514280.30956924", + 108412, + "6684.56542200", + "63446519.72816025", + "0" + ], + [ + 1589511600000, + "9490.10000000", + "9563.02000000", + "9432.00000000", + "9472.97000000", + "5798.15189800", + 1589515199999, + "55068353.83791373", + 46831, + "3011.76590100", + "28593953.62155781", + "0" + ], + [ + 1589515200000, + "9472.97000000", + "9510.00000000", + "9436.02000000", + "9444.21000000", + "3158.23801800", + 1589518799999, + "29930573.77073198", + 30434, + "1510.02479100", + "14312637.24991122", + "0" + ], + [ + 1589518800000, + "9445.70000000", + "9525.01000000", + "9370.38000000", + "9505.34000000", + "4852.16850500", + 1589522399999, + "45840578.51266231", + 46064, + "2311.47521800", + "21839767.46118178", + "0" + ], + [ + 1589522400000, + "9505.34000000", + "9554.00000000", + "9496.93000000", + "9548.00000000", + "2874.07430000", + 1589525999999, + "27400687.37941418", + 33387, + "1309.00331600", + "12479579.29801167", + "0" + ], + [ + 1589526000000, + "9548.00000000", + "9729.81000000", + "9538.02000000", + "9674.33000000", + "6150.03461900", + 1589529599999, + "59313423.90299462", + 55276, + "3176.58596000", + "30637553.05022398", + "0" + ], + [ + 1589529600000, + "9673.45000000", + "9710.00000000", + "9604.38000000", + "9616.00000000", + "3935.38230800", + 1589533199999, + "38010182.53498113", + 42118, + "1980.00648700", + "19127083.29678174", + "0" + ], + [ + 1589533200000, + "9616.00000000", + "9656.25000000", + "9544.00000000", + "9610.52000000", + "3869.31674500", + 1589536799999, + "37167272.92716276", + 37373, + "1937.32134300", + "18612034.24478301", + "0" + ], + [ + 1589536800000, + "9610.09000000", + "9627.37000000", + "9480.00000000", + "9587.14000000", + "4521.18927400", + 1589540399999, + "43225267.42547798", + 46404, + "2055.71224200", + "19658830.85348948", + "0" + ], + [ + 1589540400000, + "9587.70000000", + "9655.00000000", + "9550.21000000", + "9592.38000000", + "3150.80789300", + 1589543999999, + "30276635.31139363", + 36073, + "1617.08776500", + "15545519.49572556", + "0" + ], + [ + 1589544000000, + "9593.53000000", + "9593.53000000", + "9510.00000000", + "9520.13000000", + "3887.62198100", + 1589547599999, + "37122470.18883631", + 35864, + "1841.72190700", + "17588955.33856971", + "0" + ], + [ + 1589547600000, + "9521.49000000", + "9579.12000000", + "9490.00000000", + "9545.99000000", + "3446.66537800", + 1589551199999, + "32890238.48995190", + 30376, + "1715.98001600", + "16383333.72096016", + "0" + ], + [ + 1589551200000, + "9545.54000000", + "9616.65000000", + "9545.49000000", + "9568.02000000", + "3146.37195700", + 1589554799999, + "30154666.36356345", + 31418, + "1670.28390300", + "16009248.21348019", + "0" + ], + [ + 1589554800000, + "9568.17000000", + "9570.81000000", + "9413.93000000", + "9475.53000000", + "7235.42573100", + 1589558399999, + "68595668.59962748", + 56117, + "3214.58265300", + "30471158.94155844", + "0" + ], + [ + 1589558400000, + "9476.33000000", + "9517.01000000", + "9446.94000000", + "9470.72000000", + "3614.55244700", + 1589561999999, + "34296701.38787985", + 31565, + "1960.63728500", + "18605646.96881283", + "0" + ], + [ + 1589562000000, + "9471.18000000", + "9506.31000000", + "9442.00000000", + "9478.08000000", + "2914.45881800", + 1589565599999, + "27603224.72890886", + 24057, + "1216.64569400", + "11525878.96048938", + "0" + ], + [ + 1589565600000, + "9478.01000000", + "9534.78000000", + "9475.02000000", + "9490.18000000", + "2136.35586800", + 1589569199999, + "20306343.99805409", + 23906, + "939.47855500", + "8931517.65710187", + "0" + ], + [ + 1589569200000, + "9490.35000000", + "9511.10000000", + "9331.66000000", + "9337.83000000", + "6396.04383100", + 1589572799999, + "60095186.26408823", + 54874, + "2687.30928200", + "25250265.51707000", + "0" + ], + [ + 1589572800000, + "9337.86000000", + "9409.26000000", + "9150.00000000", + "9250.25000000", + "12123.53440300", + 1589576399999, + "112349407.07256419", + 90572, + "5683.42918700", + "52694791.58295346", + "0" + ], + [ + 1589576400000, + "9250.29000000", + "9455.18000000", + "9211.10000000", + "9419.98000000", + "5204.02745300", + 1589579999999, + "48623155.85048646", + 62966, + "2868.29899000", + "26801542.87715291", + "0" + ], + [ + 1589580000000, + "9419.98000000", + "9487.58000000", + "9340.43000000", + "9365.82000000", + "3294.57263100", + 1589583599999, + "31040590.66176851", + 40539, + "1580.00591900", + "14888016.63453881", + "0" + ], + [ + 1589583600000, + "9366.23000000", + "9395.83000000", + "9228.99000000", + "9316.42000000", + "3480.60147700", + 1589587199999, + "32464511.04382822", + 35089, + "1841.43527600", + "17178792.53293125", + "0" + ], + [ + 1589587200000, + "9315.96000000", + "9399.97000000", + "9220.00000000", + "9396.01000000", + "4432.00633300", + 1589590799999, + "41288344.19374510", + 48827, + "2127.46514800", + "19826369.55360598", + "0" + ], + [ + 1589590800000, + "9396.01000000", + "9444.88000000", + "9361.72000000", + "9410.71000000", + "2558.98297500", + 1589594399999, + "24065828.03036010", + 28277, + "1261.23382300", + "11862348.85347514", + "0" + ], + [ + 1589594400000, + "9410.71000000", + "9458.16000000", + "9382.41000000", + "9432.29000000", + "2052.11885300", + 1589597999999, + "19341502.55366571", + 23759, + "965.54096300", + "9099919.58400801", + "0" + ], + [ + 1589598000000, + "9432.30000000", + "9448.32000000", + "9390.30000000", + "9405.68000000", + "1674.41831200", + 1589601599999, + "15770660.44078993", + 17914, + "951.85904800", + "8966770.72631696", + "0" + ], + [ + 1589601600000, + "9405.68000000", + "9499.97000000", + "9396.82000000", + "9495.42000000", + "2641.12456400", + 1589605199999, + "24983730.92499187", + 27206, + "1096.09613300", + "10370119.93498760", + "0" + ], + [ + 1589605200000, + "9495.67000000", + "9588.00000000", + "9445.14000000", + "9459.32000000", + "4632.85452000", + 1589608799999, + "44081479.31906748", + 45860, + "2343.06872400", + "22293856.49495982", + "0" + ], + [ + 1589608800000, + "9459.32000000", + "9483.68000000", + "9412.53000000", + "9470.08000000", + "1777.81046300", + 1589612399999, + "16807936.58634396", + 22162, + "789.47911100", + "7462849.23932087", + "0" + ], + [ + 1589612400000, + "9470.08000000", + "9510.00000000", + "9367.13000000", + "9390.02000000", + "2487.01596900", + 1589615999999, + "23485821.32382775", + 30310, + "1210.87596700", + "11435452.76989145", + "0" + ], + [ + 1589616000000, + "9390.03000000", + "9438.73000000", + "9351.25000000", + "9423.39000000", + "2614.53417900", + 1589619599999, + "24570198.93019845", + 33219, + "1370.48983500", + "12880617.47812920", + "0" + ], + [ + 1589619600000, + "9423.30000000", + "9434.94000000", + "9315.00000000", + "9415.71000000", + "2227.71090600", + 1589623199999, + "20907873.97094612", + 31214, + "1004.35319000", + "9427279.28308607", + "0" + ], + [ + 1589623200000, + "9416.18000000", + "9458.00000000", + "9370.00000000", + "9455.00000000", + "2151.78496300", + 1589626799999, + "20254545.65897935", + 29596, + "1278.09868700", + "12030744.57475826", + "0" + ], + [ + 1589626800000, + "9455.00000000", + "9458.00000000", + "9382.86000000", + "9414.53000000", + "1620.94247200", + 1589630399999, + "15274956.95094039", + 23837, + "866.64379000", + "8167990.51753846", + "0" + ], + [ + 1589630400000, + "9414.54000000", + "9500.00000000", + "9404.00000000", + "9471.45000000", + "2985.48168700", + 1589633999999, + "28258042.53901841", + 35530, + "1745.10665200", + "16519784.55928245", + "0" + ], + [ + 1589634000000, + "9471.44000000", + "9534.85000000", + "9425.00000000", + "9452.42000000", + "4037.53810000", + 1589637599999, + "38256331.41581912", + 32925, + "1601.28234200", + "15172818.61905598", + "0" + ], + [ + 1589637600000, + "9452.42000000", + "9493.39000000", + "9400.00000000", + "9432.31000000", + "2196.37600200", + 1589641199999, + "20735421.80846083", + 30644, + "978.70105100", + "9242030.72480785", + "0" + ], + [ + 1589641200000, + "9432.31000000", + "9440.00000000", + "9330.00000000", + "9380.75000000", + "2928.63198400", + 1589644799999, + "27488810.47079829", + 33133, + "1249.19053900", + "11729140.49151448", + "0" + ], + [ + 1589644800000, + "9380.42000000", + "9419.00000000", + "9320.00000000", + "9385.72000000", + "3246.34680500", + 1589648399999, + "30406296.16177552", + 35092, + "1581.36694600", + "14808098.19628018", + "0" + ], + [ + 1589648400000, + "9385.26000000", + "9408.66000000", + "9291.00000000", + "9322.26000000", + "2555.09184300", + 1589651999999, + "23895715.21522501", + 27626, + "1161.45945600", + "10864466.12627316", + "0" + ], + [ + 1589652000000, + "9321.80000000", + "9347.25000000", + "9262.00000000", + "9286.87000000", + "3095.84966400", + 1589655599999, + "28795475.62159738", + 30084, + "1391.65453300", + "12945066.63472165", + "0" + ], + [ + 1589655600000, + "9286.96000000", + "9353.32000000", + "9268.00000000", + "9329.78000000", + "1723.27209800", + 1589659199999, + "16068283.48335892", + 22247, + "765.92037300", + "7140461.18321473", + "0" + ], + [ + 1589659200000, + "9329.78000000", + "9392.78000000", + "9294.17000000", + "9383.00000000", + "1733.26181600", + 1589662799999, + "16208607.83508944", + 24299, + "856.33460700", + "8008199.22492795", + "0" + ], + [ + 1589662800000, + "9382.72000000", + "9425.96000000", + "9354.00000000", + "9381.88000000", + "1423.85172600", + 1589666399999, + "13359267.68419612", + 21073, + "798.32037400", + "7491311.51587129", + "0" + ], + [ + 1589666400000, + "9381.88000000", + "9442.98000000", + "9360.56000000", + "9421.67000000", + "1634.91217100", + 1589669999999, + "15373092.01480336", + 19303, + "886.71059800", + "8341487.62833211", + "0" + ], + [ + 1589670000000, + "9421.69000000", + "9436.63000000", + "9363.39000000", + "9381.27000000", + "1155.70945700", + 1589673599999, + "10868781.89191001", + 17891, + "580.11631000", + "5455652.29944168", + "0" + ], + [ + 1589673600000, + "9380.81000000", + "9507.00000000", + "9322.10000000", + "9480.00000000", + "3808.47758700", + 1589677199999, + "35958686.38846822", + 39366, + "2213.61113900", + "20913765.76423174", + "0" + ], + [ + 1589677200000, + "9480.00000000", + "9521.53000000", + "9432.04000000", + "9471.78000000", + "2613.58819900", + 1589680799999, + "24807015.89447620", + 25435, + "1204.85885600", + "11438744.28727029", + "0" + ], + [ + 1589680800000, + "9471.67000000", + "9555.10000000", + "9470.00000000", + "9512.99000000", + "2135.39319000", + 1589684399999, + "20348140.55692135", + 24454, + "1103.74006000", + "10517331.55746042", + "0" + ], + [ + 1589684400000, + "9512.53000000", + "9579.16000000", + "9493.13000000", + "9545.58000000", + "2235.13232900", + 1589687999999, + "21327531.79240597", + 25332, + "1068.99412100", + "10200679.85093613", + "0" + ], + [ + 1589688000000, + "9544.49000000", + "9573.63000000", + "9506.92000000", + "9508.11000000", + "1506.92891700", + 1589691599999, + "14362892.79346994", + 19291, + "764.09140700", + "7282219.22940776", + "0" + ], + [ + 1589691600000, + "9508.10000000", + "9532.94000000", + "9475.00000000", + "9495.00000000", + "1390.99468600", + 1589695199999, + "13222422.69933452", + 17645, + "718.09262700", + "6825805.06199880", + "0" + ], + [ + 1589695200000, + "9495.00000000", + "9555.00000000", + "9495.00000000", + "9548.45000000", + "1363.66433300", + 1589698799999, + "12997139.39976580", + 19603, + "661.47063500", + "6305169.71731626", + "0" + ], + [ + 1589698800000, + "9549.28000000", + "9567.85000000", + "9506.20000000", + "9540.99000000", + "1788.92656900", + 1589702399999, + "17060937.50554868", + 22371, + "805.64774500", + "7683270.17926137", + "0" + ], + [ + 1589702400000, + "9540.98000000", + "9554.73000000", + "9480.04000000", + "9491.00000000", + "1788.37671700", + 1589705999999, + "17006822.25838093", + 23898, + "863.90025000", + "8215628.24898279", + "0" + ], + [ + 1589706000000, + "9491.01000000", + "9514.95000000", + "9436.00000000", + "9491.73000000", + "1678.18941300", + 1589709599999, + "15922503.86888839", + 21954, + "709.88221100", + "6736842.58312477", + "0" + ], + [ + 1589709600000, + "9491.01000000", + "9538.36000000", + "9491.00000000", + "9531.10000000", + "1310.41723100", + 1589713199999, + "12476407.94798570", + 18878, + "673.01441800", + "6407416.89318955", + "0" + ], + [ + 1589713200000, + "9531.00000000", + "9535.49000000", + "9493.01000000", + "9522.08000000", + "1522.64706100", + 1589716799999, + "14482574.94632322", + 17819, + "825.04522300", + "7847056.24830057", + "0" + ], + [ + 1589716800000, + "9522.50000000", + "9774.95000000", + "9521.45000000", + "9767.50000000", + "9693.02390600", + 1589720399999, + "93894927.27050918", + 86557, + "5546.67354800", + "53706829.73736525", + "0" + ], + [ + 1589720400000, + "9768.75000000", + "9787.00000000", + "9682.01000000", + "9744.99000000", + "4461.65121300", + 1589723999999, + "43419256.34135280", + 43223, + "2088.71319700", + "20328202.91709291", + "0" + ], + [ + 1589724000000, + "9745.00000000", + "9822.00000000", + "9723.00000000", + "9809.91000000", + "4264.48336000", + 1589727599999, + "41678575.71531791", + 42168, + "2449.43061600", + "23945142.03380656", + "0" + ], + [ + 1589727600000, + "9811.18000000", + "9888.00000000", + "9764.07000000", + "9822.32000000", + "7330.02459800", + 1589731199999, + "72009007.18345576", + 60203, + "3599.98714500", + "35368183.41109051", + "0" + ], + [ + 1589731200000, + "9822.64000000", + "9840.00000000", + "9685.00000000", + "9739.00000000", + "4411.47884200", + 1589734799999, + "43076909.17122058", + 40700, + "2077.46532100", + "20277804.74166809", + "0" + ], + [ + 1589734800000, + "9739.00000000", + "9770.98000000", + "9713.71000000", + "9759.99000000", + "1650.45547400", + 1589738399999, + "16088705.44225988", + 21318, + "878.84851100", + "8566753.86613192", + "0" + ], + [ + 1589738400000, + "9760.00000000", + "9763.99000000", + "9705.00000000", + "9749.98000000", + "1645.46547200", + 1589741999999, + "16022620.02081774", + 21196, + "732.81211600", + "7136294.43331907", + "0" + ], + [ + 1589742000000, + "9749.98000000", + "9791.95000000", + "9727.86000000", + "9771.00000000", + "1690.75867400", + 1589745599999, + "16512015.65980890", + 19855, + "748.00734100", + "7303827.31999579", + "0" + ], + [ + 1589745600000, + "9771.29000000", + "9772.35000000", + "9722.96000000", + "9740.14000000", + "1342.10006300", + 1589749199999, + "13083879.94751332", + 18544, + "565.31591400", + "5510613.79519136", + "0" + ], + [ + 1589749200000, + "9741.62000000", + "9798.49000000", + "9738.25000000", + "9764.52000000", + "1315.05374900", + 1589752799999, + "12847101.68891808", + 19993, + "671.23990400", + "6558117.45160506", + "0" + ], + [ + 1589752800000, + "9764.62000000", + "9765.58000000", + "9595.20000000", + "9689.31000000", + "5626.22515400", + 1589756399999, + "54374682.80793613", + 49975, + "2799.74569600", + "27066242.70451916", + "0" + ], + [ + 1589756400000, + "9689.31000000", + "9729.88000000", + "9657.91000000", + "9680.04000000", + "2074.30758600", + 1589759999999, + "20108043.51419887", + 22940, + "963.44699200", + "9336973.94317080", + "0" + ], + [ + 1589760000000, + "9681.11000000", + "9788.46000000", + "9680.13000000", + "9778.38000000", + "3189.42956100", + 1589763599999, + "31098597.68649308", + 32343, + "1548.43215900", + "15098339.11640062", + "0" + ], + [ + 1589763600000, + "9778.34000000", + "9950.00000000", + "9757.54000000", + "9902.10000000", + "10934.12166800", + 1589767199999, + "108201708.16528880", + 81749, + "7020.03765000", + "69477832.54128513", + "0" + ], + [ + 1589767200000, + "9902.62000000", + "9926.00000000", + "9827.79000000", + "9870.05000000", + "3099.88063300", + 1589770799999, + "30630073.20986945", + 37413, + "1538.39061100", + "15200516.24851506", + "0" + ], + [ + 1589770800000, + "9870.05000000", + "9891.00000000", + "9816.27000000", + "9860.51000000", + "2256.65123400", + 1589774399999, + "22243391.78062457", + 27411, + "1027.88013000", + "10133763.49268595", + "0" + ], + [ + 1589774400000, + "9860.51000000", + "9910.00000000", + "9830.00000000", + "9866.83000000", + "3280.90919800", + 1589777999999, + "32412025.93141268", + 31291, + "1635.74141900", + "16159926.88446269", + "0" + ], + [ + 1589778000000, + "9866.40000000", + "9902.87000000", + "9851.56000000", + "9861.07000000", + "1826.72285400", + 1589781599999, + "18040785.67011534", + 22910, + "868.97937400", + "8582626.87880168", + "0" + ], + [ + 1589781600000, + "9861.32000000", + "9884.54000000", + "9730.00000000", + "9778.89000000", + "4870.68376500", + 1589785199999, + "47691057.06466553", + 42590, + "2268.53813800", + "22212586.47889658", + "0" + ], + [ + 1589785200000, + "9778.90000000", + "9809.00000000", + "9735.60000000", + "9785.71000000", + "2161.31707000", + 1589788799999, + "21132048.74069484", + 26317, + "971.59274200", + "9500061.88686179", + "0" + ], + [ + 1589788800000, + "9785.70000000", + "9796.91000000", + "9464.23000000", + "9591.54000000", + "9535.84815800", + 1589792399999, + "91698303.97590259", + 75187, + "3312.47006400", + "31895444.25610990", + "0" + ], + [ + 1589792400000, + "9591.57000000", + "9616.43000000", + "9541.34000000", + "9579.11000000", + "4416.35758200", + 1589795999999, + "42315723.74060347", + 41028, + "2180.42941700", + "20895051.84818098", + "0" + ], + [ + 1589796000000, + "9579.10000000", + "9666.66000000", + "9566.96000000", + "9628.39000000", + "3873.62663600", + 1589799599999, + "37299252.92277895", + 37405, + "1815.99306800", + "17483451.30066680", + "0" + ], + [ + 1589799600000, + "9629.24000000", + "9714.95000000", + "9625.00000000", + "9634.89000000", + "3042.22167700", + 1589803199999, + "29383208.51473455", + 28565, + "1560.30698300", + "15073042.76937151", + "0" + ], + [ + 1589803200000, + "9634.89000000", + "9670.00000000", + "9565.10000000", + "9665.00000000", + "3245.47133200", + 1589806799999, + "31220110.46377067", + 32082, + "1387.19740600", + "13348194.74441243", + "0" + ], + [ + 1589806800000, + "9665.00000000", + "9694.04000000", + "9638.64000000", + "9661.96000000", + "2886.47671600", + 1589810399999, + "27909146.41191202", + 28391, + "1180.75898300", + "11417239.42811299", + "0" + ], + [ + 1589810400000, + "9661.97000000", + "9735.00000000", + "9631.82000000", + "9708.56000000", + "3105.44488400", + 1589813999999, + "30126487.10953000", + 34727, + "1549.88619600", + "15037870.11476182", + "0" + ], + [ + 1589814000000, + "9708.50000000", + "9723.00000000", + "9639.74000000", + "9670.96000000", + "2663.86256600", + 1589817599999, + "25801153.73401196", + 30406, + "1338.59378200", + "12965838.71446298", + "0" + ], + [ + 1589817600000, + "9670.97000000", + "9710.00000000", + "9601.03000000", + "9638.43000000", + "3557.08451300", + 1589821199999, + "34351897.13762075", + 35443, + "1744.54118600", + "16857021.82505165", + "0" + ], + [ + 1589821200000, + "9638.42000000", + "9659.13000000", + "9550.01000000", + "9625.07000000", + "3068.68912100", + 1589824799999, + "29480546.66665333", + 26314, + "1181.78320800", + "11355101.71239978", + "0" + ], + [ + 1589824800000, + "9625.07000000", + "9671.85000000", + "9613.00000000", + "9657.86000000", + "1661.36977600", + 1589828399999, + "16009287.74886674", + 17002, + "928.39097000", + "8946814.56943918", + "0" + ], + [ + 1589828400000, + "9657.86000000", + "9720.00000000", + "9657.85000000", + "9701.70000000", + "2957.75975000", + 1589831999999, + "28677898.85300263", + 26314, + "1917.49671300", + "18593123.63358838", + "0" + ], + [ + 1589832000000, + "9701.70000000", + "9720.00000000", + "9650.00000000", + "9685.78000000", + "1335.98324400", + 1589835599999, + "12936065.04811792", + 16678, + "581.14539500", + "5627019.71909964", + "0" + ], + [ + 1589835600000, + "9685.79000000", + "9726.86000000", + "9673.65000000", + "9686.23000000", + "1303.38013600", + 1589839199999, + "12646628.77484318", + 21170, + "647.34027500", + "6281163.38693361", + "0" + ], + [ + 1589839200000, + "9686.23000000", + "9747.35000000", + "9666.67000000", + "9723.88000000", + "1672.14939200", + 1589842799999, + "16260720.87946626", + 20592, + "958.81901800", + "9323918.53712667", + "0" + ], + [ + 1589842800000, + "9723.79000000", + "9755.00000000", + "9695.51000000", + "9733.93000000", + "2061.16211700", + 1589846399999, + "20056177.09518896", + 20964, + "1078.09809900", + "10491636.11294973", + "0" + ], + [ + 1589846400000, + "9733.93000000", + "9742.95000000", + "9574.06000000", + "9640.01000000", + "4552.91720500", + 1589849999999, + "43864629.02375434", + 40107, + "1932.60214800", + "18618409.03491541", + "0" + ], + [ + 1589850000000, + "9640.00000000", + "9667.89000000", + "9625.00000000", + "9651.27000000", + "1353.94579300", + 1589853599999, + "13061874.77069308", + 18103, + "584.43101600", + "5638417.29292858", + "0" + ], + [ + 1589853600000, + "9651.67000000", + "9655.71000000", + "9535.00000000", + "9612.43000000", + "3328.15077400", + 1589857199999, + "31917430.29349080", + 32893, + "1268.00369000", + "12167303.70219627", + "0" + ], + [ + 1589857200000, + "9612.43000000", + "9634.00000000", + "9493.03000000", + "9530.00000000", + "3520.30893700", + 1589860799999, + "33663973.98467560", + 32728, + "1277.61869600", + "12228970.33292695", + "0" + ], + [ + 1589860800000, + "9530.51000000", + "9579.58000000", + "9474.00000000", + "9537.78000000", + "3286.32978800", + 1589864399999, + "31334694.10700018", + 36149, + "1230.63777500", + "11737266.86322356", + "0" + ], + [ + 1589864400000, + "9536.82000000", + "9607.68000000", + "9526.38000000", + "9603.09000000", + "2261.68746800", + 1589867999999, + "21646107.12932767", + 27289, + "996.92949900", + "9545302.66695920", + "0" + ], + [ + 1589868000000, + "9603.09000000", + "9625.00000000", + "9582.86000000", + "9585.97000000", + "1486.91083200", + 1589871599999, + "14277254.87185131", + 20787, + "698.83023100", + "6709765.14285281", + "0" + ], + [ + 1589871600000, + "9586.18000000", + "9622.44000000", + "9550.00000000", + "9573.99000000", + "1876.50148200", + 1589875199999, + "18000254.15939505", + 20375, + "828.99101300", + "7953152.99183054", + "0" + ], + [ + 1589875200000, + "9573.99000000", + "9829.00000000", + "9570.11000000", + "9803.94000000", + "10037.46020300", + 1589878799999, + "97962953.27530131", + 75104, + "5780.56839500", + "56398848.38200545", + "0" + ], + [ + 1589878800000, + "9804.07000000", + "9820.00000000", + "9768.00000000", + "9792.00000000", + "4111.00879000", + 1589882399999, + "40259744.06564465", + 34937, + "1778.80142000", + "17419197.34575565", + "0" + ], + [ + 1589882400000, + "9792.00000000", + "9806.59000000", + "9756.00000000", + "9792.99000000", + "2501.78117300", + 1589885999999, + "24483547.75756150", + 24784, + "1280.11952100", + "12527563.06564290", + "0" + ], + [ + 1589886000000, + "9792.99000000", + "9897.21000000", + "9696.00000000", + "9751.98000000", + "7690.16540300", + 1589889599999, + "75401027.62130053", + 64444, + "4319.90691400", + "42395090.13863202", + "0" + ], + [ + 1589889600000, + "9752.24000000", + "9762.00000000", + "9561.00000000", + "9619.54000000", + "7209.41698100", + 1589893199999, + "69559157.95307414", + 68184, + "2929.10130300", + "28271994.10560742", + "0" + ], + [ + 1589893200000, + "9619.53000000", + "9687.49000000", + "9591.13000000", + "9673.25000000", + "5035.98374600", + 1589896799999, + "48563453.78304157", + 40610, + "2451.85687800", + "23647830.18216115", + "0" + ], + [ + 1589896800000, + "9672.85000000", + "9736.73000000", + "9666.00000000", + "9696.78000000", + "3502.58028900", + 1589900399999, + "33975648.14621619", + 28139, + "2006.78720300", + "19466707.92712579", + "0" + ], + [ + 1589900400000, + "9696.88000000", + "9736.83000000", + "9646.69000000", + "9687.06000000", + "2526.09010700", + 1589903999999, + "24486623.83739470", + 27558, + "1206.92933000", + "11701538.35273975", + "0" + ], + [ + 1589904000000, + "9687.06000000", + "9729.35000000", + "9665.80000000", + "9692.75000000", + "1596.64387500", + 1589907599999, + "15492793.88523466", + 22828, + "757.50505900", + "7350567.29800546", + "0" + ], + [ + 1589907600000, + "9693.03000000", + "9714.85000000", + "9622.33000000", + "9658.97000000", + "2089.50844900", + 1589911199999, + "20196621.59642880", + 23839, + "932.28392400", + "9013233.46811531", + "0" + ], + [ + 1589911200000, + "9659.50000000", + "9718.43000000", + "9646.07000000", + "9698.03000000", + "1528.50366000", + 1589914799999, + "14813089.67506375", + 17059, + "786.22542000", + "7618278.45687756", + "0" + ], + [ + 1589914800000, + "9697.90000000", + "9718.00000000", + "9636.88000000", + "9644.13000000", + "1958.07383100", + 1589918399999, + "18950505.31266959", + 23990, + "1097.96615100", + "10627196.69094744", + "0" + ], + [ + 1589918400000, + "9644.92000000", + "9701.00000000", + "9620.49000000", + "9692.04000000", + "1729.00004700", + 1589921999999, + "16701930.16120518", + 22277, + "720.19948000", + "6959117.00524635", + "0" + ], + [ + 1589922000000, + "9692.04000000", + "9700.00000000", + "9658.46000000", + "9683.83000000", + "914.77216800", + 1589925599999, + "8858196.49985050", + 17473, + "424.82047600", + "4113061.78646630", + "0" + ], + [ + 1589925600000, + "9683.83000000", + "9770.00000000", + "9656.81000000", + "9756.12000000", + "2419.64763700", + 1589929199999, + "23524787.02663500", + 28015, + "1459.35705100", + "14188136.32397811", + "0" + ], + [ + 1589929200000, + "9756.12000000", + "9794.00000000", + "9703.44000000", + "9775.53000000", + "2022.37181600", + 1589932799999, + "19717647.07173599", + 25909, + "1071.24671500", + "10448479.65102093", + "0" + ], + [ + 1589932800000, + "9775.13000000", + "9800.00000000", + "9721.83000000", + "9742.61000000", + "2513.59052000", + 1589936399999, + "24555262.53351736", + 28324, + "1076.99775800", + "10523199.21316869", + "0" + ], + [ + 1589936400000, + "9741.85000000", + "9769.00000000", + "9730.30000000", + "9744.35000000", + "1233.77477200", + 1589939999999, + "12032127.13113318", + 17026, + "495.60102600", + "4833062.24140325", + "0" + ], + [ + 1589940000000, + "9744.35000000", + "9749.07000000", + "9707.00000000", + "9736.04000000", + "1517.12650900", + 1589943599999, + "14757842.64196684", + 18271, + "696.03581700", + "6771228.15217140", + "0" + ], + [ + 1589943600000, + "9736.04000000", + "9774.99000000", + "9715.79000000", + "9724.40000000", + "1681.86938100", + 1589947199999, + "16400088.43947015", + 19920, + "770.47571300", + "7513301.70737571", + "0" + ], + [ + 1589947200000, + "9724.09000000", + "9752.61000000", + "9696.56000000", + "9735.30000000", + "1433.19765500", + 1589950799999, + "13944121.07464125", + 15605, + "748.25311600", + "7282058.25104149", + "0" + ], + [ + 1589950800000, + "9735.45000000", + "9754.74000000", + "9715.89000000", + "9754.36000000", + "1010.46262800", + 1589954399999, + "9841856.26956016", + 14432, + "474.38604400", + "4620825.82999305", + "0" + ], + [ + 1589954400000, + "9754.36000000", + "9842.00000000", + "9651.00000000", + "9724.39000000", + "5609.35687300", + 1589957999999, + "54754662.56279839", + 49003, + "2796.19957200", + "27305054.90090454", + "0" + ], + [ + 1589958000000, + "9724.39000000", + "9788.04000000", + "9701.36000000", + "9764.51000000", + "2816.88650200", + 1589961599999, + "27499478.46299496", + 26113, + "1404.40856400", + "13710734.92766993", + "0" + ], + [ + 1589961600000, + "9764.51000000", + "9799.99000000", + "9741.00000000", + "9780.00000000", + "2530.50816000", + 1589965199999, + "24742887.89755064", + 25233, + "1056.31876200", + "10329377.43202090", + "0" + ], + [ + 1589965200000, + "9780.00000000", + "9798.61000000", + "9746.50000000", + "9788.27000000", + "1817.88740800", + 1589968799999, + "17768299.99352180", + 21846, + "965.63572500", + "9438567.72929372", + "0" + ], + [ + 1589968800000, + "9788.27000000", + "9810.00000000", + "9726.41000000", + "9774.98000000", + "2422.40251800", + 1589972399999, + "23659430.14983886", + 25377, + "1148.50993300", + "11219413.53401841", + "0" + ], + [ + 1589972400000, + "9774.98000000", + "9780.69000000", + "9715.00000000", + "9731.21000000", + "1989.27479500", + 1589975999999, + "19392635.04753310", + 24319, + "864.59362500", + "8430009.23787688", + "0" + ], + [ + 1589976000000, + "9731.22000000", + "9786.00000000", + "9721.34000000", + "9766.00000000", + "2226.51878000", + 1589979599999, + "21726108.24486533", + 26784, + "967.29619100", + "9440313.98393566", + "0" + ], + [ + 1589979600000, + "9766.01000000", + "9790.00000000", + "9745.00000000", + "9789.80000000", + "2018.74370200", + 1589983199999, + "19732273.27553904", + 22211, + "1001.71585600", + "9791341.99210164", + "0" + ], + [ + 1589983200000, + "9789.80000000", + "9799.00000000", + "9761.03000000", + "9765.09000000", + "1666.89112700", + 1589986799999, + "16295497.82526362", + 19300, + "795.10759200", + "7772814.93670957", + "0" + ], + [ + 1589986800000, + "9765.47000000", + "9767.84000000", + "9326.00000000", + "9414.50000000", + "18223.81241100", + 1589990399999, + "174011231.97496304", + 131534, + "6667.40417800", + "63640004.09227790", + "0" + ], + [ + 1589990400000, + "9414.51000000", + "9528.95000000", + "9352.27000000", + "9497.99000000", + "8529.59004500", + 1589993999999, + "80714388.85970599", + 71060, + "4013.15641800", + "37966776.63332775", + "0" + ], + [ + 1589994000000, + "9497.99000000", + "9547.32000000", + "9441.99000000", + "9539.47000000", + "3661.46027500", + 1589997599999, + "34786711.23586428", + 37889, + "1660.60624500", + "15779655.60785654", + "0" + ], + [ + 1589997600000, + "9539.23000000", + "9546.00000000", + "9504.49000000", + "9531.82000000", + "1923.84139400", + 1590001199999, + "18324711.20744380", + 21732, + "777.48806000", + "7405827.28716900", + "0" + ], + [ + 1590001200000, + "9531.83000000", + "9538.97000000", + "9485.00000000", + "9531.99000000", + "1913.71467000", + 1590004799999, + "18204578.38708858", + 20797, + "969.78922200", + "9226284.75043876", + "0" + ], + [ + 1590004800000, + "9531.99000000", + "9598.00000000", + "9511.42000000", + "9588.58000000", + "2284.71459200", + 1590008399999, + "21844545.02449655", + 24074, + "1216.21307700", + "11628543.14027172", + "0" + ], + [ + 1590008400000, + "9588.50000000", + "9589.95000000", + "9532.43000000", + "9551.21000000", + "1608.98168200", + 1590011999999, + "15382383.64505213", + 21511, + "817.70190900", + "7816741.27063618", + "0" + ], + [ + 1590012000000, + "9551.53000000", + "9570.95000000", + "9504.06000000", + "9527.75000000", + "1490.82648500", + 1590015599999, + "14222814.31600675", + 19963, + "748.00593800", + "7136622.00809797", + "0" + ], + [ + 1590015600000, + "9527.78000000", + "9550.00000000", + "9435.87000000", + "9511.43000000", + "2798.30520600", + 1590019199999, + "26596866.56258673", + 28865, + "1349.89633700", + "12834573.10269206", + "0" + ], + [ + 1590019200000, + "9511.43000000", + "9578.47000000", + "9478.69000000", + "9556.46000000", + "1908.99249600", + 1590022799999, + "18203071.32798329", + 25741, + "934.23947900", + "8910064.47747098", + "0" + ], + [ + 1590022800000, + "9557.72000000", + "9564.37000000", + "9510.00000000", + "9514.90000000", + "1188.80960900", + 1590026399999, + "11335457.47201420", + 16126, + "519.95996200", + "4958129.03174104", + "0" + ], + [ + 1590026400000, + "9514.58000000", + "9532.78000000", + "9458.24000000", + "9472.05000000", + "1792.00436000", + 1590029999999, + "17026169.99074296", + 22448, + "880.76077400", + "8370372.53553394", + "0" + ], + [ + 1590030000000, + "9472.11000000", + "9503.86000000", + "9447.26000000", + "9483.37000000", + "2119.86957800", + 1590033599999, + "20091226.16391384", + 24439, + "1033.61475600", + "9796471.92116758", + "0" + ], + [ + 1590033600000, + "9483.37000000", + "9500.06000000", + "9400.00000000", + "9483.65000000", + "2424.09044300", + 1590037199999, + "22933302.36661781", + 25066, + "908.16132300", + "8594699.64468601", + "0" + ], + [ + 1590037200000, + "9483.66000000", + "9521.71000000", + "9483.00000000", + "9503.10000000", + "1873.70818500", + 1590040799999, + "17813441.50237752", + 18303, + "825.86654200", + "7851174.26798214", + "0" + ], + [ + 1590040800000, + "9503.09000000", + "9532.39000000", + "9487.00000000", + "9488.45000000", + "1847.44811000", + 1590044399999, + "17568623.94656043", + 20045, + "839.62120200", + "7984974.52620893", + "0" + ], + [ + 1590044400000, + "9488.91000000", + "9497.35000000", + "9446.00000000", + "9457.83000000", + "2587.18697700", + 1590047999999, + "24512734.81029179", + 25669, + "1078.54354500", + "10219084.26714104", + "0" + ], + [ + 1590048000000, + "9457.88000000", + "9505.57000000", + "9268.00000000", + "9377.66000000", + "8490.57592600", + 1590051599999, + "79638410.56017254", + 66728, + "3428.19594500", + "32169795.12399786", + "0" + ], + [ + 1590051600000, + "9377.73000000", + "9432.70000000", + "9297.64000000", + "9298.79000000", + "5012.38574500", + 1590055199999, + "46986915.82003292", + 44003, + "2597.60039800", + "24355982.35205536", + "0" + ], + [ + 1590055200000, + "9298.79000000", + "9381.53000000", + "9228.00000000", + "9374.77000000", + "4954.97521600", + 1590058799999, + "46202293.07396119", + 39792, + "2273.81754700", + "21207588.71212226", + "0" + ], + [ + 1590058800000, + "9374.77000000", + "9390.47000000", + "9340.00000000", + "9389.97000000", + "2331.12963600", + 1590062399999, + "21842509.03467288", + 24684, + "1021.29921900", + "9568382.51630556", + "0" + ], + [ + 1590062400000, + "9389.97000000", + "9395.43000000", + "9320.00000000", + "9362.64000000", + "2745.60045200", + 1590065999999, + "25688062.29277035", + 27902, + "1294.08512600", + "12108457.39653981", + "0" + ], + [ + 1590066000000, + "9362.39000000", + "9387.00000000", + "9251.82000000", + "9293.09000000", + "3325.21507400", + 1590069599999, + "31025533.18726907", + 32839, + "1501.76223500", + "14015220.29465478", + "0" + ], + [ + 1590069600000, + "9292.60000000", + "9318.29000000", + "8949.74000000", + "9084.00000000", + "21576.40045100", + 1590073199999, + "196786637.25121269", + 136443, + "9341.09331800", + "85247354.17726362", + "0" + ], + [ + 1590073200000, + "9084.14000000", + "9155.00000000", + "9050.00000000", + "9084.38000000", + "7578.88434400", + 1590076799999, + "68973662.63609650", + 56299, + "3758.48943700", + "34204176.12227244", + "0" + ], + [ + 1590076800000, + "9082.50000000", + "9135.09000000", + "9041.00000000", + "9081.42000000", + "3874.86049400", + 1590080399999, + "35232369.64300162", + 39543, + "2023.26632500", + "18395781.27108421", + "0" + ], + [ + 1590080400000, + "9081.54000000", + "9104.66000000", + "8970.00000000", + "9006.99000000", + "4318.39735400", + 1590083999999, + "39075505.74312415", + 37943, + "2038.88521500", + "18453447.57552839", + "0" + ], + [ + 1590084000000, + "9006.99000000", + "9010.38000000", + "8815.00000000", + "8831.26000000", + "9773.09636900", + 1590087599999, + "87137424.95180734", + 72531, + "4394.75401000", + "39195221.31346612", + "0" + ], + [ + 1590087600000, + "8832.09000000", + "9100.00000000", + "8816.91000000", + "9065.53000000", + "7995.62623100", + 1590091199999, + "72045181.46206844", + 65825, + "3970.77893300", + "35757795.55503920", + "0" + ], + [ + 1590091200000, + "9065.81000000", + "9085.00000000", + "9011.21000000", + "9055.26000000", + "2835.54915300", + 1590094799999, + "25662606.21893794", + 31004, + "1339.27438900", + "12117325.32732289", + "0" + ], + [ + 1590094800000, + "9055.10000000", + "9152.24000000", + "9050.71000000", + "9103.85000000", + "3610.14943400", + 1590098399999, + "32886869.42376643", + 43516, + "1696.11341500", + "15448115.38694858", + "0" + ], + [ + 1590098400000, + "9103.85000000", + "9164.99000000", + "9103.85000000", + "9125.20000000", + "2155.07623600", + 1590101999999, + "19679218.78028107", + 24787, + "999.89093600", + "9131786.50032281", + "0" + ], + [ + 1590102000000, + "9125.20000000", + "9134.53000000", + "9034.73000000", + "9068.65000000", + "2608.74909600", + 1590105599999, + "23699038.28158273", + 30295, + "1214.00710700", + "11027973.87202403", + "0" + ], + [ + 1590105600000, + "9067.51000000", + "9069.82000000", + "8970.01000000", + "9026.67000000", + "3644.15556500", + 1590109199999, + "32868600.74918045", + 35751, + "1680.43005700", + "15160518.07452344", + "0" + ], + [ + 1590109200000, + "9026.66000000", + "9133.62000000", + "9024.06000000", + "9089.45000000", + "2596.10953100", + 1590112799999, + "23620263.72153157", + 30827, + "1268.00516100", + "11533628.21259264", + "0" + ], + [ + 1590112800000, + "9090.59000000", + "9128.41000000", + "9041.26000000", + "9041.64000000", + "1523.02756600", + 1590116399999, + "13842823.00659726", + 21490, + "741.33156500", + "6740248.31828388", + "0" + ], + [ + 1590116400000, + "9041.59000000", + "9071.42000000", + "8953.91000000", + "8995.55000000", + "2578.05920900", + 1590119999999, + "23242771.30400771", + 29943, + "1242.53222300", + "11202607.87128871", + "0" + ], + [ + 1590120000000, + "8995.00000000", + "9038.71000000", + "8933.52000000", + "8998.07000000", + "2402.11592700", + 1590123599999, + "21609032.36630956", + 27247, + "1176.37178600", + "10584342.37515387", + "0" + ], + [ + 1590123600000, + "8998.39000000", + "9076.47000000", + "8961.22000000", + "9047.99000000", + "2623.11472100", + 1590127199999, + "23662107.30353381", + 25332, + "1242.21190900", + "11206213.16321816", + "0" + ], + [ + 1590127200000, + "9047.99000000", + "9100.00000000", + "9033.00000000", + "9087.60000000", + "2199.04609600", + 1590130799999, + "19952207.35583945", + 29102, + "1030.42440500", + "9349419.02320947", + "0" + ], + [ + 1590130800000, + "9087.60000000", + "9120.00000000", + "9037.15000000", + "9081.81000000", + "3216.92764900", + 1590134399999, + "29240998.41849855", + 38314, + "1575.88042500", + "14322429.52678716", + "0" + ], + [ + 1590134400000, + "9081.81000000", + "9110.60000000", + "9044.94000000", + "9092.99000000", + "2549.69266400", + 1590137999999, + "23143376.65666836", + 31387, + "1388.60395900", + "12605029.98758910", + "0" + ], + [ + 1590138000000, + "9092.99000000", + "9110.99000000", + "9060.00000000", + "9110.00000000", + "1948.65107400", + 1590141599999, + "17704380.29747373", + 26795, + "1008.95016700", + "9166481.45865743", + "0" + ], + [ + 1590141600000, + "9110.00000000", + "9206.92000000", + "9110.00000000", + "9165.41000000", + "5016.03155400", + 1590145199999, + "45979747.60110360", + 49328, + "2538.03622300", + "23261540.33245288", + "0" + ], + [ + 1590145200000, + "9164.63000000", + "9192.00000000", + "9127.71000000", + "9166.00000000", + "2447.20296600", + 1590148799999, + "22419347.03248481", + 29862, + "1140.15193100", + "10446487.76810330", + "0" + ], + [ + 1590148800000, + "9166.00000000", + "9205.17000000", + "9146.27000000", + "9173.03000000", + "2805.78984300", + 1590152399999, + "25752316.38292089", + 29315, + "1431.86523800", + "13142864.56977908", + "0" + ], + [ + 1590152400000, + "9173.15000000", + "9181.72000000", + "9079.78000000", + "9116.08000000", + "3089.03216500", + 1590155999999, + "28203194.66013239", + 35836, + "1351.42147900", + "12338294.04711685", + "0" + ], + [ + 1590156000000, + "9116.41000000", + "9169.76000000", + "9116.01000000", + "9135.02000000", + "1896.72741800", + 1590159599999, + "17346908.18880742", + 24979, + "1018.74620300", + "9316502.11770053", + "0" + ], + [ + 1590159600000, + "9134.96000000", + "9222.95000000", + "9134.93000000", + "9222.69000000", + "2759.43239000", + 1590163199999, + "25345253.84599707", + 30346, + "1527.83411900", + "14033173.08299773", + "0" + ], + [ + 1590163200000, + "9222.95000000", + "9248.00000000", + "9180.55000000", + "9241.71000000", + "3559.23092900", + 1590166799999, + "32776881.35493327", + 41191, + "1758.09862600", + "16191514.87201095", + "0" + ], + [ + 1590166800000, + "9241.71000000", + "9271.00000000", + "9170.00000000", + "9192.92000000", + "3287.37659900", + 1590170399999, + "30317154.04383747", + 34417, + "1531.10482700", + "14126488.77141914", + "0" + ], + [ + 1590170400000, + "9192.57000000", + "9224.00000000", + "9171.50000000", + "9200.25000000", + "1578.40544000", + 1590173999999, + "14522132.97217201", + 23187, + "702.65521100", + "6464608.47112381", + "0" + ], + [ + 1590174000000, + "9200.25000000", + "9221.72000000", + "9141.51000000", + "9173.72000000", + "1897.31989500", + 1590177599999, + "17421127.14297499", + 23834, + "969.71997100", + "8905702.61738650", + "0" + ], + [ + 1590177600000, + "9173.72000000", + "9208.00000000", + "9130.60000000", + "9177.79000000", + "1768.74576500", + 1590181199999, + "16222468.22904030", + 24496, + "993.75923900", + "9114012.21947465", + "0" + ], + [ + 1590181200000, + "9177.28000000", + "9208.00000000", + "9160.00000000", + "9205.00000000", + "952.02102200", + 1590184799999, + "8746928.28249457", + 16210, + "533.35117500", + "4900472.39868223", + "0" + ], + [ + 1590184800000, + "9205.30000000", + "9215.00000000", + "9173.09000000", + "9196.33000000", + "1079.56280400", + 1590188399999, + "9929076.14289197", + 14369, + "521.50022600", + "4796130.76849580", + "0" + ], + [ + 1590188400000, + "9196.32000000", + "9197.04000000", + "9131.12000000", + "9170.00000000", + "1525.35223200", + 1590191999999, + "13978737.43727742", + 20136, + "614.32977100", + "5630187.21097781", + "0" + ], + [ + 1590192000000, + "9170.00000000", + "9252.00000000", + "9169.99000000", + "9239.97000000", + "2541.73135100", + 1590195599999, + "23429361.08513941", + 26559, + "1437.34033100", + "13248346.95598754", + "0" + ], + [ + 1590195600000, + "9239.97000000", + "9267.32000000", + "9221.61000000", + "9236.64000000", + "1730.18635500", + 1590199199999, + "15991252.35509549", + 20734, + "741.92046600", + "6858748.78617932", + "0" + ], + [ + 1590199200000, + "9236.64000000", + "9289.00000000", + "9229.55000000", + "9271.27000000", + "1927.23748000", + 1590202799999, + "17858807.54927641", + 23362, + "913.76599200", + "8468049.66189018", + "0" + ], + [ + 1590202800000, + "9271.27000000", + "9307.85000000", + "9267.25000000", + "9286.61000000", + "1914.65057400", + 1590206399999, + "17788846.26171876", + 21975, + "869.52580900", + "8078998.03551939", + "0" + ], + [ + 1590206400000, + "9286.11000000", + "9300.00000000", + "9237.57000000", + "9252.75000000", + "1552.79839200", + 1590209999999, + "14394843.25326762", + 18936, + "728.67582900", + "6756580.48529254", + "0" + ], + [ + 1590210000000, + "9252.81000000", + "9268.08000000", + "9231.00000000", + "9263.34000000", + "1442.57667000", + 1590213599999, + "13345409.52577729", + 17103, + "594.82426900", + "5502655.06738850", + "0" + ], + [ + 1590213600000, + "9263.33000000", + "9263.43000000", + "9207.38000000", + "9244.73000000", + "2602.74045900", + 1590217199999, + "24024299.63516845", + 21129, + "1615.27017900", + "14906381.07219483", + "0" + ], + [ + 1590217200000, + "9244.72000000", + "9268.11000000", + "9223.84000000", + "9255.28000000", + "1053.67532200", + 1590220799999, + "9743855.78113300", + 16477, + "468.10712200", + "4328562.41906837", + "0" + ], + [ + 1590220800000, + "9255.70000000", + "9255.70000000", + "9164.35000000", + "9187.84000000", + "3272.75287000", + 1590224399999, + "30099171.22981916", + 33550, + "1524.46001300", + "14019355.09567439", + "0" + ], + [ + 1590224400000, + "9188.27000000", + "9200.00000000", + "9110.10000000", + "9138.78000000", + "2425.27730900", + 1590227999999, + "22226954.48832430", + 25240, + "1211.81495600", + "11108757.03339956", + "0" + ], + [ + 1590228000000, + "9138.78000000", + "9153.64000000", + "9096.07000000", + "9139.01000000", + "2845.75260300", + 1590231599999, + "25963648.09440288", + 28848, + "1299.00069600", + "11854697.32625814", + "0" + ], + [ + 1590231600000, + "9139.00000000", + "9187.86000000", + "9128.17000000", + "9172.25000000", + "1648.59856500", + 1590235199999, + "15110708.55812755", + 20802, + "813.46443600", + "7456164.64536434", + "0" + ], + [ + 1590235200000, + "9172.26000000", + "9173.44000000", + "9070.00000000", + "9132.19000000", + "2617.06523700", + 1590238799999, + "23880779.60392749", + 26678, + "1166.14657200", + "10642202.64776243", + "0" + ], + [ + 1590238800000, + "9132.00000000", + "9175.00000000", + "9113.10000000", + "9153.01000000", + "1484.59109100", + 1590242399999, + "13589295.09982851", + 20674, + "786.00861900", + "7195356.50113487", + "0" + ], + [ + 1590242400000, + "9153.07000000", + "9220.00000000", + "9138.00000000", + "9198.56000000", + "2057.07765200", + 1590245999999, + "18903078.99215376", + 22638, + "1112.88015100", + "10226783.24883280", + "0" + ], + [ + 1590246000000, + "9198.55000000", + "9212.62000000", + "9170.00000000", + "9198.78000000", + "1524.10592800", + 1590249599999, + "14004159.46176163", + 18814, + "762.92236600", + "7011364.97203176", + "0" + ], + [ + 1590249600000, + "9198.78000000", + "9209.06000000", + "9136.00000000", + "9170.91000000", + "1789.09435700", + 1590253199999, + "16398323.17461790", + 21760, + "817.10441500", + "7490302.55620760", + "0" + ], + [ + 1590253200000, + "9170.92000000", + "9198.93000000", + "9155.81000000", + "9180.05000000", + "1005.05227500", + 1590256799999, + "9226432.14085691", + 14443, + "500.24244100", + "4592596.58467751", + "0" + ], + [ + 1590256800000, + "9179.72000000", + "9205.29000000", + "9150.00000000", + "9163.98000000", + "1165.94161900", + 1590260399999, + "10696019.07126930", + 16324, + "556.97565300", + "5109930.59783777", + "0" + ], + [ + 1590260400000, + "9163.98000000", + "9197.00000000", + "9125.00000000", + "9180.98000000", + "1394.80729700", + 1590263999999, + "12790469.49620905", + 18889, + "605.71135300", + "5557394.31341990", + "0" + ], + [ + 1590264000000, + "9180.97000000", + "9247.63000000", + "9164.01000000", + "9229.58000000", + "2004.09104500", + 1590267599999, + "18462607.30214593", + 25104, + "1198.85379200", + "11045066.79618972", + "0" + ], + [ + 1590267600000, + "9229.58000000", + "9239.92000000", + "9209.50000000", + "9225.99000000", + "978.36281600", + 1590271199999, + "9024973.22582796", + 19212, + "540.47445100", + "4985716.25823328", + "0" + ], + [ + 1590271200000, + "9226.00000000", + "9247.56000000", + "9209.87000000", + "9225.00000000", + "999.36256500", + 1590274799999, + "9224001.33190197", + 12666, + "509.56720500", + "4703146.07580037", + "0" + ], + [ + 1590274800000, + "9225.00000000", + "9229.78000000", + "9152.44000000", + "9179.15000000", + "1548.76713400", + 1590278399999, + "14229898.91117161", + 20543, + "602.55921600", + "5535634.03959054", + "0" + ], + [ + 1590278400000, + "9179.01000000", + "9212.00000000", + "9120.77000000", + "9196.38000000", + "2185.04957900", + 1590281999999, + "20034882.11597710", + 28413, + "834.52188200", + "7652734.83809693", + "0" + ], + [ + 1590282000000, + "9196.38000000", + "9212.23000000", + "9170.67000000", + "9171.91000000", + "1064.59944800", + 1590285599999, + "9785706.04525690", + 18515, + "494.87634200", + "4548728.11828486", + "0" + ], + [ + 1590285600000, + "9171.95000000", + "9231.00000000", + "9171.95000000", + "9198.96000000", + "1275.44227800", + 1590289199999, + "11744695.37374439", + 19470, + "585.60333900", + "5392494.90344720", + "0" + ], + [ + 1590289200000, + "9198.96000000", + "9216.59000000", + "9180.00000000", + "9192.76000000", + "874.07860200", + 1590292799999, + "8041110.35266441", + 16979, + "483.34147600", + "4446899.94990612", + "0" + ], + [ + 1590292800000, + "9192.77000000", + "9221.72000000", + "9190.00000000", + "9190.54000000", + "811.78162800", + 1590296399999, + "7474305.96480925", + 13585, + "410.37616100", + "3778535.71891710", + "0" + ], + [ + 1590296400000, + "9191.35000000", + "9216.33000000", + "9184.00000000", + "9205.00000000", + "681.24417400", + 1590299999999, + "6269800.42031771", + 12377, + "318.82349400", + "2934098.30138413", + "0" + ], + [ + 1590300000000, + "9204.99000000", + "9297.00000000", + "9204.99000000", + "9274.81000000", + "3337.88711600", + 1590303599999, + "30953099.76420181", + 34123, + "1764.17182100", + "16356466.15610850", + "0" + ], + [ + 1590303600000, + "9274.98000000", + "9290.38000000", + "9241.37000000", + "9255.53000000", + "1573.64937700", + 1590307199999, + "14591168.67442026", + 19218, + "748.56060200", + "6941805.77907869", + "0" + ], + [ + 1590307200000, + "9255.54000000", + "9272.42000000", + "9239.00000000", + "9258.54000000", + "1307.95689500", + 1590310799999, + "12106397.04930904", + 19979, + "617.73930700", + "5717390.45974875", + "0" + ], + [ + 1590310800000, + "9258.88000000", + "9298.00000000", + "9252.85000000", + "9270.73000000", + "1640.35100700", + 1590314399999, + "15223678.91602277", + 22526, + "936.75536200", + "8693579.07037097", + "0" + ], + [ + 1590314400000, + "9270.73000000", + "9289.00000000", + "9251.06000000", + "9263.40000000", + "1261.21495500", + 1590317999999, + "11693556.34719478", + 21466, + "651.45457100", + "6040729.14159996", + "0" + ], + [ + 1590318000000, + "9263.85000000", + "9264.87000000", + "9100.00000000", + "9119.00000000", + "5413.43434000", + 1590321599999, + "49677521.96426539", + 48753, + "2376.00776000", + "21806191.35017581", + "0" + ], + [ + 1590321600000, + "9119.00000000", + "9179.31000000", + "9090.78000000", + "9159.90000000", + "3262.57214700", + 1590325199999, + "29822376.77587408", + 35044, + "1532.12124800", + "14006333.44017068", + "0" + ], + [ + 1590325200000, + "9159.90000000", + "9160.20000000", + "9040.01000000", + "9087.49000000", + "3861.33872900", + 1590328799999, + "35127175.64177800", + 38183, + "1922.58523000", + "17492128.47635713", + "0" + ], + [ + 1590328800000, + "9087.12000000", + "9092.93000000", + "9000.00000000", + "9070.05000000", + "4630.42295400", + 1590332399999, + "41912627.54621557", + 42516, + "2179.94730400", + "19735687.22740172", + "0" + ], + [ + 1590332400000, + "9071.37000000", + "9092.00000000", + "9022.17000000", + "9055.74000000", + "2071.98031800", + 1590335999999, + "18784140.67960802", + 27824, + "986.29038000", + "8941997.89659714", + "0" + ], + [ + 1590336000000, + "9055.60000000", + "9055.61000000", + "8853.21000000", + "8939.12000000", + "10578.65627100", + 1590339599999, + "94550716.64068932", + 88101, + "4854.55339300", + "43387548.41238046", + "0" + ], + [ + 1590339600000, + "8938.11000000", + "8989.83000000", + "8924.68000000", + "8947.84000000", + "3837.21248800", + 1590343199999, + "34351267.99479660", + 37500, + "1728.81443000", + "15475411.07848725", + "0" + ], + [ + 1590343200000, + "8947.84000000", + "8982.14000000", + "8890.41000000", + "8941.99000000", + "2350.06335400", + 1590346799999, + "21018117.99225263", + 28253, + "1074.49939300", + "9612161.91685395", + "0" + ], + [ + 1590346800000, + "8941.04000000", + "9040.00000000", + "8937.00000000", + "9018.45000000", + "3038.76546400", + 1590350399999, + "27357274.38646295", + 31671, + "1473.57561500", + "13261817.63997845", + "0" + ], + [ + 1590350400000, + "9017.37000000", + "9040.00000000", + "8983.05000000", + "9000.31000000", + "2110.61304300", + 1590353999999, + "19022836.36754382", + 25567, + "936.05056100", + "8439337.21709854", + "0" + ], + [ + 1590354000000, + "9000.93000000", + "9080.99000000", + "9000.00000000", + "9054.22000000", + "1741.18256100", + 1590357599999, + "15750045.49250227", + 28221, + "888.17818100", + "8033641.19484553", + "0" + ], + [ + 1590357600000, + "9054.21000000", + "9063.74000000", + "9015.00000000", + "9043.10000000", + "1848.81188200", + 1590361199999, + "16708192.84939463", + 30783, + "975.97825000", + "8820859.15867302", + "0" + ], + [ + 1590361200000, + "9043.13000000", + "9055.63000000", + "8700.00000000", + "8720.34000000", + "9621.55784000", + 1590364799999, + "84786545.01802307", + 85021, + "3271.58534200", + "28845691.02618430", + "0" + ], + [ + 1590364800000, + "8718.14000000", + "8822.90000000", + "8642.72000000", + "8811.37000000", + "6190.14239100", + 1590368399999, + "54198083.17534250", + 59402, + "2815.52227700", + "24669734.57493631", + "0" + ], + [ + 1590368400000, + "8811.01000000", + "8811.01000000", + "8765.00000000", + "8791.69000000", + "2217.93043200", + 1590371999999, + "19485165.03208476", + 26433, + "1170.43952900", + "10282345.06007050", + "0" + ], + [ + 1590372000000, + "8791.72000000", + "8817.27000000", + "8768.00000000", + "8790.96000000", + "1706.20774600", + 1590375599999, + "15001573.71319521", + 22726, + "819.28101400", + "7202581.16882249", + "0" + ], + [ + 1590375600000, + "8790.67000000", + "8797.60000000", + "8741.53000000", + "8786.57000000", + "2239.44573900", + 1590379199999, + "19647636.85454375", + 26091, + "1067.75463900", + "9367230.61577565", + "0" + ], + [ + 1590379200000, + "8786.57000000", + "8815.20000000", + "8770.25000000", + "8806.00000000", + "1701.15875400", + 1590382799999, + "14962179.42040616", + 22857, + "782.38902300", + "6881688.48940050", + "0" + ], + [ + 1590382800000, + "8805.99000000", + "8820.00000000", + "8761.07000000", + "8782.93000000", + "1775.95739400", + 1590386399999, + "15598387.32387134", + 19831, + "848.15579800", + "7450120.00859252", + "0" + ], + [ + 1590386400000, + "8782.93000000", + "8815.78000000", + "8762.23000000", + "8789.51000000", + "1900.58733400", + 1590389999999, + "16708263.62573269", + 24133, + "983.26540800", + "8644542.76295065", + "0" + ], + [ + 1590390000000, + "8789.52000000", + "8874.41000000", + "8772.27000000", + "8867.31000000", + "3021.44118100", + 1590393599999, + "26687274.44265921", + 36562, + "1549.06281500", + "13682201.12834828", + "0" + ], + [ + 1590393600000, + "8867.31000000", + "8881.24000000", + "8813.21000000", + "8820.54000000", + "2214.06393900", + 1590397199999, + "19577884.58621631", + 29178, + "942.36312400", + "8335513.64734855", + "0" + ], + [ + 1590397200000, + "8820.43000000", + "8875.18000000", + "8705.26000000", + "8753.95000000", + "4355.64709000", + 1590400799999, + "38266424.49286421", + 41785, + "2090.30784500", + "18367042.96855355", + "0" + ], + [ + 1590400800000, + "8753.94000000", + "8797.00000000", + "8675.00000000", + "8689.00000000", + "3527.38444700", + 1590404399999, + "30832852.32056346", + 38497, + "1491.62317100", + "13043413.55616227", + "0" + ], + [ + 1590404400000, + "8688.58000000", + "8768.64000000", + "8668.29000000", + "8752.41000000", + "3205.30377300", + 1590407999999, + "27976454.35800336", + 34036, + "1703.62076600", + "14872889.24007711", + "0" + ], + [ + 1590408000000, + "8753.20000000", + "8786.88000000", + "8731.52000000", + "8761.01000000", + "2560.70023400", + 1590411599999, + "22441934.32711160", + 34060, + "1289.46676700", + "11300945.53770593", + "0" + ], + [ + 1590411600000, + "8761.16000000", + "8835.86000000", + "8728.41000000", + "8814.14000000", + "2847.34298300", + 1590415199999, + "24972751.65042270", + 35756, + "1479.40443400", + "12977444.55168449", + "0" + ], + [ + 1590415200000, + "8813.21000000", + "8857.00000000", + "8744.39000000", + "8755.95000000", + "3604.90199000", + 1590418799999, + "31773302.47103010", + 39637, + "1638.71075600", + "14447202.55950795", + "0" + ], + [ + 1590418800000, + "8756.00000000", + "8806.46000000", + "8742.53000000", + "8782.44000000", + "2295.12761500", + 1590422399999, + "20133029.35320016", + 27547, + "1111.90017400", + "9754895.11295481", + "0" + ], + [ + 1590422400000, + "8781.22000000", + "8847.70000000", + "8762.27000000", + "8810.07000000", + "2474.40684400", + 1590425999999, + "21816768.20688445", + 27414, + "1326.07565500", + "11692085.14198836", + "0" + ], + [ + 1590426000000, + "8810.52000000", + "8918.00000000", + "8792.30000000", + "8893.50000000", + "3519.38237300", + 1590429599999, + "31193080.90460412", + 33330, + "1990.84893000", + "17651546.82127373", + "0" + ], + [ + 1590429600000, + "8893.56000000", + "8909.92000000", + "8860.00000000", + "8886.17000000", + "2232.67520500", + 1590433199999, + "19835667.58965891", + 25467, + "1097.11776300", + "9747540.66895990", + "0" + ], + [ + 1590433200000, + "8885.71000000", + "8979.66000000", + "8871.46000000", + "8928.06000000", + "3497.83237300", + 1590436799999, + "31250541.02187864", + 35647, + "1763.50525900", + "15755757.53061825", + "0" + ], + [ + 1590436800000, + "8928.06000000", + "8950.00000000", + "8896.13000000", + "8913.54000000", + "1568.78854000", + 1590440399999, + "13993623.99103405", + 22297, + "769.76372800", + "6866913.72630309", + "0" + ], + [ + 1590440400000, + "8913.53000000", + "8926.55000000", + "8860.98000000", + "8900.00000000", + "1511.92723300", + 1590443999999, + "13445835.70647712", + 28289, + "770.87961800", + "6854344.39616475", + "0" + ], + [ + 1590444000000, + "8899.42000000", + "8923.57000000", + "8865.10000000", + "8903.30000000", + "1170.04788200", + 1590447599999, + "10413594.35174837", + 22729, + "520.74853700", + "4634875.06497543", + "0" + ], + [ + 1590447600000, + "8903.24000000", + "8940.00000000", + "8889.90000000", + "8900.35000000", + "1495.50745700", + 1590451199999, + "13332976.99448068", + 19853, + "749.68171400", + "6683916.61176329", + "0" + ], + [ + 1590451200000, + "8900.35000000", + "8925.00000000", + "8822.74000000", + "8866.06000000", + "2755.97899200", + 1590454799999, + "24451239.36858448", + 34195, + "1254.48798000", + "11126974.34970874", + "0" + ], + [ + 1590454800000, + "8866.21000000", + "8892.25000000", + "8856.07000000", + "8881.53000000", + "1396.12085500", + 1590458399999, + "12388739.42193619", + 18051, + "590.64503100", + "5240984.89902596", + "0" + ], + [ + 1590458400000, + "8881.53000000", + "8917.88000000", + "8871.89000000", + "8882.40000000", + "1471.25492300", + 1590461999999, + "13087499.23055925", + 19675, + "668.87870900", + "5950417.70462845", + "0" + ], + [ + 1590462000000, + "8881.96000000", + "8930.00000000", + "8871.58000000", + "8903.76000000", + "1593.11723400", + 1590465599999, + "14192994.45092789", + 19888, + "837.14657000", + "7459540.78860356", + "0" + ], + [ + 1590465600000, + "8903.75000000", + "8926.26000000", + "8880.15000000", + "8905.82000000", + "1509.13244500", + 1590469199999, + "13442780.51037814", + 24558, + "777.20386200", + "6924051.50335354", + "0" + ], + [ + 1590469200000, + "8905.37000000", + "8940.00000000", + "8891.93000000", + "8937.43000000", + "1925.26747700", + 1590472799999, + "17169416.68849742", + 23691, + "1145.88389600", + "10221085.04661313", + "0" + ], + [ + 1590472800000, + "8937.42000000", + "8940.00000000", + "8881.26000000", + "8887.59000000", + "2033.58793900", + 1590476399999, + "18112917.97461751", + 25136, + "895.04422500", + "7972887.17801699", + "0" + ], + [ + 1590476400000, + "8888.69000000", + "8965.00000000", + "8860.05000000", + "8957.49000000", + "3930.13564700", + 1590479999999, + "35087963.74338490", + 33943, + "2261.54440300", + "20201354.40039577", + "0" + ], + [ + 1590480000000, + "8956.83000000", + "9017.67000000", + "8943.01000000", + "8960.01000000", + "3748.06864900", + 1590483599999, + "33669900.93322222", + 33858, + "1777.74473000", + "15972882.92545356", + "0" + ], + [ + 1590483600000, + "8960.01000000", + "8993.00000000", + "8870.00000000", + "8893.70000000", + "3373.32739400", + 1590487199999, + "30098451.45203740", + 34341, + "1578.58906500", + "14087174.98345779", + "0" + ], + [ + 1590487200000, + "8893.70000000", + "8900.00000000", + "8832.38000000", + "8861.41000000", + "3376.79679400", + 1590490799999, + "29946489.55505118", + 37180, + "1388.54672500", + "12315458.91369765", + "0" + ], + [ + 1590490800000, + "8861.51000000", + "8886.00000000", + "8841.00000000", + "8869.15000000", + "1854.76529300", + 1590494399999, + "16441982.09383660", + 25609, + "903.59751700", + "8010335.11524435", + "0" + ], + [ + 1590494400000, + "8869.32000000", + "8914.56000000", + "8788.04000000", + "8817.21000000", + "3863.56507100", + 1590497999999, + "34136531.56729328", + 38279, + "1831.58313900", + "16184440.65104128", + "0" + ], + [ + 1590498000000, + "8816.76000000", + "8862.00000000", + "8785.03000000", + "8809.22000000", + "2526.02338500", + 1590501599999, + "22294523.04056078", + 29869, + "1257.98839600", + "11103241.99564121", + "0" + ], + [ + 1590501600000, + "8809.15000000", + "8858.96000000", + "8791.91000000", + "8817.17000000", + "2496.25986000", + 1590505199999, + "22037451.71651085", + 30980, + "1287.29496000", + "11364688.06966322", + "0" + ], + [ + 1590505200000, + "8817.50000000", + "8837.26000000", + "8705.00000000", + "8726.60000000", + "4695.00894900", + 1590508799999, + "41149177.48518668", + 44535, + "1908.14417100", + "16729757.45941835", + "0" + ], + [ + 1590508800000, + "8726.60000000", + "8808.45000000", + "8700.00000000", + "8790.01000000", + "3823.66914300", + 1590512399999, + "33537891.83041516", + 44086, + "1774.07446800", + "15565729.01933776", + "0" + ], + [ + 1590512400000, + "8790.01000000", + "8820.00000000", + "8782.73000000", + "8811.03000000", + "1894.61365900", + 1590515999999, + "16680169.44007117", + 26606, + "823.53666900", + "7251184.88465944", + "0" + ], + [ + 1590516000000, + "8810.67000000", + "8819.99000000", + "8792.00000000", + "8810.99000000", + "1630.40440800", + 1590519599999, + "14357130.98414325", + 21073, + "884.36835800", + "7787366.99674057", + "0" + ], + [ + 1590519600000, + "8810.99000000", + "8811.00000000", + "8760.20000000", + "8800.00000000", + "1929.67556200", + 1590523199999, + "16955002.45768806", + 22658, + "906.48440600", + "7962960.26794266", + "0" + ], + [ + 1590523200000, + "8800.00000000", + "8880.00000000", + "8799.99000000", + "8856.20000000", + "2401.13599800", + 1590526799999, + "21232780.43961550", + 26495, + "1419.95873600", + "12558057.45050033", + "0" + ], + [ + 1590526800000, + "8855.93000000", + "8880.00000000", + "8825.63000000", + "8842.25000000", + "1366.29631900", + 1590530399999, + "12093284.44165587", + 22210, + "719.30320800", + "6366883.41488859", + "0" + ], + [ + 1590530400000, + "8842.98000000", + "8843.95000000", + "8801.12000000", + "8834.92000000", + "1506.87028200", + 1590533999999, + "13297226.35349831", + 22253, + "784.78443200", + "6925414.96850075", + "0" + ], + [ + 1590534000000, + "8834.59000000", + "8859.00000000", + "8815.00000000", + "8841.18000000", + "1198.69386000", + 1590537599999, + "10593583.71101595", + 19135, + "565.33642700", + "4996071.17844111", + "0" + ], + [ + 1590537600000, + "8841.00000000", + "8897.80000000", + "8832.61000000", + "8886.87000000", + "2281.67435100", + 1590541199999, + "20233869.73317571", + 24836, + "1072.92254900", + "9518692.67420401", + "0" + ], + [ + 1590541200000, + "8886.88000000", + "8893.00000000", + "8845.79000000", + "8855.00000000", + "1131.99262200", + 1590544799999, + "10033447.00539261", + 17464, + "550.85141600", + "4882211.16294490", + "0" + ], + [ + 1590544800000, + "8855.00000000", + "8878.16000000", + "8811.73000000", + "8822.59000000", + "1726.73333600", + 1590548399999, + "15283097.62067070", + 20896, + "699.88686100", + "6192441.25389790", + "0" + ], + [ + 1590548400000, + "8821.76000000", + "8854.68000000", + "8820.43000000", + "8828.90000000", + "1114.53535500", + 1590551999999, + "9852403.51831131", + 16948, + "500.83111200", + "4427125.48545207", + "0" + ], + [ + 1590552000000, + "8829.12000000", + "8860.68000000", + "8825.00000000", + "8859.62000000", + "1160.20711300", + 1590555599999, + "10258329.20933178", + 14165, + "547.70410300", + "4842390.14103186", + "0" + ], + [ + 1590555600000, + "8859.65000000", + "8881.69000000", + "8855.35000000", + "8878.00000000", + "1619.32583500", + 1590559199999, + "14358451.16121897", + 17026, + "708.34528100", + "6281535.48622824", + "0" + ], + [ + 1590559200000, + "8878.00000000", + "8887.75000000", + "8831.82000000", + "8846.37000000", + "1473.18047400", + 1590562799999, + "13040656.08913815", + 21094, + "694.57056200", + "6147932.23314293", + "0" + ], + [ + 1590562800000, + "8846.38000000", + "8862.50000000", + "8829.40000000", + "8844.28000000", + "1618.07115000", + 1590566399999, + "14317859.01644903", + 15951, + "706.79362000", + "6254480.74948540", + "0" + ], + [ + 1590566400000, + "8844.89000000", + "8955.00000000", + "8844.00000000", + "8930.00000000", + "4527.56478200", + 1590569999999, + "40368189.63907514", + 33465, + "2220.53913300", + "19797323.10011512", + "0" + ], + [ + 1590570000000, + "8930.00000000", + "8940.00000000", + "8902.91000000", + "8923.57000000", + "2475.38988900", + 1590573599999, + "22088502.82383826", + 24501, + "1154.99731100", + "10307155.70662878", + "0" + ], + [ + 1590573600000, + "8923.57000000", + "9170.00000000", + "8918.51000000", + "9128.00000000", + "9556.04195400", + 1590577199999, + "86674763.06820866", + 70322, + "5310.08996300", + "48153877.70786455", + "0" + ], + [ + 1590577200000, + "9128.10000000", + "9160.00000000", + "9107.15000000", + "9150.74000000", + "4828.09672700", + 1590580799999, + "44086078.66001484", + 46317, + "2079.67638600", + "18990551.51989092", + "0" + ], + [ + 1590580800000, + "9148.87000000", + "9190.00000000", + "9125.32000000", + "9145.00000000", + "5395.87363100", + 1590584399999, + "49440210.94732620", + 44277, + "2594.64188600", + "23774954.44279714", + "0" + ], + [ + 1590584400000, + "9145.00000000", + "9182.99000000", + "9126.03000000", + "9147.25000000", + "4421.47806100", + 1590587999999, + "40480242.96237840", + 40152, + "1703.97361100", + "15600011.86749250", + "0" + ], + [ + 1590588000000, + "9148.02000000", + "9169.89000000", + "9120.00000000", + "9153.02000000", + "3255.38475600", + 1590591599999, + "29758646.91536471", + 28686, + "1506.70725700", + "13773521.27884380", + "0" + ], + [ + 1590591600000, + "9153.06000000", + "9225.00000000", + "9125.10000000", + "9148.00000000", + "5192.79359200", + 1590595199999, + "47613795.93741512", + 46729, + "2661.54656100", + "24412074.71235676", + "0" + ], + [ + 1590595200000, + "9148.01000000", + "9196.73000000", + "9135.88000000", + "9170.24000000", + "2347.19503400", + 1590598799999, + "21526837.28013715", + 26288, + "1092.05417400", + "10015078.17054095", + "0" + ], + [ + 1590598800000, + "9170.24000000", + "9218.92000000", + "9163.45000000", + "9189.65000000", + "3001.40811500", + 1590602399999, + "27573943.52157141", + 24056, + "1835.64548800", + "16862827.40355830", + "0" + ], + [ + 1590602400000, + "9189.65000000", + "9199.12000000", + "9159.79000000", + "9169.48000000", + "1558.27739200", + 1590605999999, + "14297565.81750004", + 15964, + "739.27358400", + "6782934.05172571", + "0" + ], + [ + 1590606000000, + "9169.39000000", + "9172.36000000", + "9137.71000000", + "9159.99000000", + "1465.59237000", + 1590609599999, + "13416491.73392361", + 17787, + "683.07193000", + "6253787.86933922", + "0" + ], + [ + 1590609600000, + "9159.99000000", + "9176.00000000", + "9154.87000000", + "9165.21000000", + "1172.31527500", + 1590613199999, + "10745263.75251184", + 14269, + "576.95605600", + "5288205.65748868", + "0" + ], + [ + 1590613200000, + "9167.25000000", + "9168.38000000", + "9052.39000000", + "9069.71000000", + "3308.10600500", + 1590616799999, + "30108966.45746556", + 29960, + "1499.97000200", + "13643806.93725678", + "0" + ], + [ + 1590616800000, + "9069.19000000", + "9130.00000000", + "9052.32000000", + "9104.01000000", + "1804.58314100", + 1590620399999, + "16426095.35849258", + 25124, + "1049.06062700", + "9548516.11274193", + "0" + ], + [ + 1590620400000, + "9104.09000000", + "9205.42000000", + "9095.00000000", + "9204.07000000", + "2474.53455400", + 1590623999999, + "22677147.55112522", + 26573, + "1342.51079200", + "12305899.26647639", + "0" + ], + [ + 1590624000000, + "9204.07000000", + "9280.78000000", + "9163.57000000", + "9266.45000000", + "3586.67323700", + 1590627599999, + "33032409.39845837", + 32472, + "2033.02672600", + "18736111.29956401", + "0" + ], + [ + 1590627600000, + "9267.21000000", + "9279.80000000", + "9215.43000000", + "9217.90000000", + "2582.01098700", + 1590631199999, + "23857513.55335978", + 26170, + "1180.46170200", + "10907671.29001129", + "0" + ], + [ + 1590631200000, + "9217.89000000", + "9232.60000000", + "9158.47000000", + "9204.37000000", + "1737.06428800", + 1590634799999, + "15975978.32421511", + 21048, + "767.16794000", + "7055897.81958432", + "0" + ], + [ + 1590634800000, + "9204.37000000", + "9205.74000000", + "9155.67000000", + "9172.91000000", + "1138.64804500", + 1590638399999, + "10454068.69032381", + 16375, + "599.28237400", + "5502300.06390612", + "0" + ], + [ + 1590638400000, + "9171.60000000", + "9201.72000000", + "9134.83000000", + "9181.91000000", + "1617.85071700", + 1590641999999, + "14846495.15257518", + 21329, + "664.16920000", + "6095946.68055636", + "0" + ], + [ + 1590642000000, + "9181.83000000", + "9181.92000000", + "9120.01000000", + "9167.75000000", + "1730.18969300", + 1590645599999, + "15838137.33988723", + 23572, + "960.35451600", + "8788523.51578046", + "0" + ], + [ + 1590645600000, + "9167.75000000", + "9179.85000000", + "9147.00000000", + "9170.56000000", + "1493.27702800", + 1590649199999, + "13683622.41654372", + 20015, + "698.25082100", + "6398522.90629453", + "0" + ], + [ + 1590649200000, + "9170.15000000", + "9182.94000000", + "9126.36000000", + "9150.44000000", + "1682.41796100", + 1590652799999, + "15403479.44523461", + 23606, + "793.66803200", + "7266955.00632240", + "0" + ], + [ + 1590652800000, + "9150.06000000", + "9191.90000000", + "9110.00000000", + "9190.33000000", + "1964.33893600", + 1590656399999, + "17988014.54537863", + 25158, + "856.59824800", + "7846120.52060844", + "0" + ], + [ + 1590656400000, + "9191.15000000", + "9205.92000000", + "9174.13000000", + "9202.41000000", + "2086.65302900", + 1590659999999, + "19172983.84488647", + 20698, + "1047.53723000", + "9625571.65547049", + "0" + ], + [ + 1590660000000, + "9202.88000000", + "9204.98000000", + "9163.02000000", + "9166.90000000", + "1366.87660200", + 1590663599999, + "12551857.75449178", + 20831, + "614.93193000", + "5646338.33830284", + "0" + ], + [ + 1590663600000, + "9166.76000000", + "9280.00000000", + "9156.16000000", + "9266.89000000", + "3988.70834800", + 1590667199999, + "36835825.59311992", + 38677, + "2240.15223700", + "20696057.20661813", + "0" + ], + [ + 1590667200000, + "9267.22000000", + "9440.00000000", + "9251.65000000", + "9423.62000000", + "9298.35055300", + 1590670799999, + "86962041.96120206", + 72511, + "5037.70645100", + "47110133.08071696", + "0" + ], + [ + 1590670800000, + "9423.62000000", + "9452.09000000", + "9375.86000000", + "9411.51000000", + "4999.98280500", + 1590674399999, + "47032582.99573196", + 40926, + "2371.55443700", + "22310746.42629647", + "0" + ], + [ + 1590674400000, + "9411.06000000", + "9498.21000000", + "9410.03000000", + "9466.65000000", + "5906.16229100", + 1590677999999, + "55854530.54086157", + 50626, + "3357.18409100", + "31750029.56069743", + "0" + ], + [ + 1590678000000, + "9466.85000000", + "9518.00000000", + "9435.00000000", + "9499.81000000", + "4872.71163400", + 1590681599999, + "46190323.25009055", + 38009, + "2694.16779000", + "25540813.52263387", + "0" + ], + [ + 1590681600000, + "9499.81000000", + "9537.80000000", + "9434.00000000", + "9447.78000000", + "4365.41588300", + 1590685199999, + "41350291.89327833", + 34557, + "2129.38029500", + "20174301.47406815", + "0" + ], + [ + 1590685200000, + "9448.12000000", + "9476.73000000", + "9441.67000000", + "9466.11000000", + "2156.58177900", + 1590688799999, + "20400719.58261192", + 24157, + "1105.30902500", + "10455938.38470920", + "0" + ], + [ + 1590688800000, + "9466.11000000", + "9480.00000000", + "9424.39000000", + "9425.97000000", + "2120.79828900", + 1590692399999, + "20045240.76989536", + 26670, + "1026.04725500", + "9699382.43928866", + "0" + ], + [ + 1590692400000, + "9426.00000000", + "9480.00000000", + "9391.38000000", + "9452.25000000", + "2519.93486600", + 1590695999999, + "23801807.38788056", + 27649, + "1230.23628800", + "11624887.46747598", + "0" + ], + [ + 1590696000000, + "9452.24000000", + "9459.59000000", + "9423.68000000", + "9450.18000000", + "1667.96352600", + 1590699599999, + "15753464.80055746", + 20360, + "633.08830300", + "5979886.89469782", + "0" + ], + [ + 1590699600000, + "9451.49000000", + "9485.67000000", + "9410.01000000", + "9436.75000000", + "1501.89991700", + 1590703199999, + "14177713.01295395", + 23977, + "801.31666900", + "7565304.83155743", + "0" + ], + [ + 1590703200000, + "9436.74000000", + "9552.71000000", + "9434.98000000", + "9490.03000000", + "4398.73346700", + 1590706799999, + "41747571.43988999", + 38357, + "2318.39427700", + "22004294.94562508", + "0" + ], + [ + 1590706800000, + "9490.03000000", + "9625.47000000", + "9485.00000000", + "9575.89000000", + "5327.54378100", + 1590710399999, + "50973432.48795418", + 50975, + "2814.91377200", + "26938729.53229786", + "0" + ], + [ + 1590710400000, + "9575.87000000", + "9605.26000000", + "9500.00000000", + "9512.59000000", + "3951.43049200", + 1590713999999, + "37761956.31298362", + 40477, + "1720.16198800", + "16442154.47885416", + "0" + ], + [ + 1590714000000, + "9513.19000000", + "9537.32000000", + "9461.07000000", + "9515.03000000", + "3829.79336700", + 1590717599999, + "36374723.39111791", + 31125, + "1626.23356700", + "15439494.09303674", + "0" + ], + [ + 1590717600000, + "9515.03000000", + "9539.39000000", + "9494.00000000", + "9504.45000000", + "1518.64792100", + 1590721199999, + "14451201.97490875", + 21524, + "628.82325900", + "5983405.96068361", + "0" + ], + [ + 1590721200000, + "9504.44000000", + "9535.00000000", + "9490.84000000", + "9521.26000000", + "2122.47079000", + 1590724799999, + "20185247.22657349", + 23368, + "941.96310700", + "8958235.05977722", + "0" + ], + [ + 1590724800000, + "9521.26000000", + "9545.00000000", + "9496.38000000", + "9500.49000000", + "1638.92584800", + 1590728399999, + "15602066.20622307", + 20542, + "676.05797000", + "6435762.52763128", + "0" + ], + [ + 1590728400000, + "9500.62000000", + "9535.33000000", + "9471.99000000", + "9520.00000000", + "1683.14454600", + 1590731999999, + "16002080.05531086", + 20096, + "753.58035800", + "7166698.38454916", + "0" + ], + [ + 1590732000000, + "9520.00000000", + "9553.47000000", + "9508.73000000", + "9515.38000000", + "1999.18518200", + 1590735599999, + "19054883.35952761", + 22387, + "937.95554600", + "8941095.59036742", + "0" + ], + [ + 1590735600000, + "9515.68000000", + "9542.92000000", + "9507.19000000", + "9523.50000000", + "2320.71080200", + 1590739199999, + "22101531.07993569", + 23785, + "1275.66456800", + "12149343.92460051", + "0" + ], + [ + 1590739200000, + "9523.63000000", + "9593.69000000", + "9420.38000000", + "9450.80000000", + "6078.92187800", + 1590742799999, + "57707615.08685292", + 47810, + "2813.38251900", + "26723373.85967102", + "0" + ], + [ + 1590742800000, + "9450.80000000", + "9479.00000000", + "9437.18000000", + "9445.00000000", + "2437.31251000", + 1590746399999, + "23055418.60845226", + 24375, + "1156.22424100", + "10937431.57453563", + "0" + ], + [ + 1590746400000, + "9444.99000000", + "9472.00000000", + "9356.00000000", + "9365.00000000", + "4393.80807900", + 1590749999999, + "41348746.65702419", + 41055, + "2367.64916400", + "22282618.93163121", + "0" + ], + [ + 1590750000000, + "9365.00000000", + "9420.00000000", + "9335.00000000", + "9403.87000000", + "4127.02576500", + 1590753599999, + "38748812.14915954", + 36755, + "1565.35447900", + "14696048.64621220", + "0" + ], + [ + 1590753600000, + "9403.98000000", + "9454.26000000", + "9372.18000000", + "9398.18000000", + "2276.69264900", + 1590757199999, + "21446182.63465608", + 22646, + "982.55255100", + "9257374.58946345", + "0" + ], + [ + 1590757200000, + "9398.19000000", + "9448.60000000", + "9385.12000000", + "9438.32000000", + "1581.29344900", + 1590760799999, + "14894421.93696930", + 18744, + "822.39569700", + "7745622.63178026", + "0" + ], + [ + 1590760800000, + "9438.31000000", + "9478.00000000", + "9420.01000000", + "9445.07000000", + "1905.49651200", + 1590764399999, + "18002571.12974853", + 18650, + "952.64848200", + "9001495.35246741", + "0" + ], + [ + 1590764400000, + "9445.88000000", + "9449.49000000", + "9330.00000000", + "9412.00000000", + "2733.67820300", + 1590767999999, + "25662154.02101245", + 28742, + "1270.85080100", + "11927950.18228886", + "0" + ], + [ + 1590768000000, + "9412.55000000", + "9447.59000000", + "9394.79000000", + "9434.30000000", + "2396.28257000", + 1590771599999, + "22588801.27872163", + 28004, + "1232.98610100", + "11622850.99408036", + "0" + ], + [ + 1590771600000, + "9435.04000000", + "9457.69000000", + "9410.30000000", + "9427.05000000", + "2373.04385500", + 1590775199999, + "22389523.09279706", + 23490, + "1049.53403300", + "9901982.20849841", + "0" + ], + [ + 1590775200000, + "9427.15000000", + "9443.00000000", + "9393.29000000", + "9434.46000000", + "2520.84091600", + 1590778799999, + "23741674.25359155", + 25641, + "1296.97800500", + "12215240.60115418", + "0" + ], + [ + 1590778800000, + "9434.45000000", + "9435.00000000", + "9394.02000000", + "9404.98000000", + "1286.53069200", + 1590782399999, + "12111557.04804287", + 16638, + "557.96394800", + "5252990.60200653", + "0" + ], + [ + 1590782400000, + "9404.99000000", + "9431.65000000", + "9389.99000000", + "9420.93000000", + "1102.30624500", + 1590785999999, + "10378788.06823293", + 13336, + "557.97229000", + "5253776.76283508", + "0" + ], + [ + 1590786000000, + "9420.98000000", + "9422.76000000", + "9372.00000000", + "9396.58000000", + "1059.83955900", + 1590789599999, + "9956212.95685964", + 14634, + "580.72768400", + "5454756.74890255", + "0" + ], + [ + 1590789600000, + "9396.66000000", + "9438.00000000", + "9374.16000000", + "9428.26000000", + "996.90485400", + 1590793199999, + "9380773.62667691", + 16010, + "551.00104100", + "5184375.47109409", + "0" + ], + [ + 1590793200000, + "9428.27000000", + "9452.36000000", + "9415.82000000", + "9427.07000000", + "1040.07627700", + 1590796799999, + "9811144.45109131", + 13871, + "500.55149500", + "4722459.55563160", + "0" + ], + [ + 1590796800000, + "9426.60000000", + "9433.48000000", + "9346.16000000", + "9370.14000000", + "1775.34259000", + 1590800399999, + "16657087.20956141", + 22838, + "796.35630100", + "7471131.01765569", + "0" + ], + [ + 1590800400000, + "9370.10000000", + "9402.30000000", + "9350.54000000", + "9378.09000000", + "1245.79923700", + 1590803999999, + "11683086.76395961", + 17063, + "608.58488000", + "5708087.63458956", + "0" + ], + [ + 1590804000000, + "9378.02000000", + "9395.00000000", + "9362.23000000", + "9384.41000000", + "795.85502200", + 1590807599999, + "7464900.57176672", + 12513, + "416.69676000", + "3908076.37201407", + "0" + ], + [ + 1590807600000, + "9383.71000000", + "9396.79000000", + "9331.23000000", + "9396.18000000", + "1684.04159500", + 1590811199999, + "15774980.97409535", + 20097, + "791.21965400", + "7410621.90493797", + "0" + ], + [ + 1590811200000, + "9396.63000000", + "9565.00000000", + "9391.63000000", + "9515.36000000", + "4787.45758700", + 1590814799999, + "45437007.83005282", + 48843, + "2597.47760600", + "24657618.38630722", + "0" + ], + [ + 1590814800000, + "9515.36000000", + "9566.66000000", + "9506.24000000", + "9558.90000000", + "2382.55353000", + 1590818399999, + "22711831.14377489", + 25642, + "1317.44995300", + "12560003.47133812", + "0" + ], + [ + 1590818400000, + "9558.90000000", + "9600.00000000", + "9539.89000000", + "9550.51000000", + "3202.48248100", + 1590821999999, + "30639421.25228807", + 33707, + "1620.75378900", + "15510752.49146392", + "0" + ], + [ + 1590822000000, + "9550.00000000", + "9566.35000000", + "9522.00000000", + "9528.69000000", + "2364.97647900", + 1590825599999, + "22572408.96404928", + 24997, + "1183.98717700", + "11299717.65848412", + "0" + ], + [ + 1590825600000, + "9528.73000000", + "9559.87000000", + "9527.61000000", + "9533.36000000", + "1688.83533300", + 1590829199999, + "16119769.07491272", + 20073, + "884.61056400", + "8444701.34785684", + "0" + ], + [ + 1590829200000, + "9532.75000000", + "9543.19000000", + "9459.93000000", + "9498.03000000", + "2570.01577200", + 1590832799999, + "24412477.09336050", + 27759, + "1388.59628800", + "13190743.94553905", + "0" + ], + [ + 1590832800000, + "9498.03000000", + "9533.30000000", + "9490.00000000", + "9527.61000000", + "1361.21953800", + 1590836399999, + "12952576.68101766", + 19059, + "657.15233600", + "6252407.88365416", + "0" + ], + [ + 1590836400000, + "9527.73000000", + "9583.00000000", + "9523.78000000", + "9554.17000000", + "2541.25102500", + 1590839999999, + "24279111.68237325", + 28862, + "1543.69661400", + "14750448.02772193", + "0" + ], + [ + 1590840000000, + "9554.51000000", + "9557.44000000", + "9509.30000000", + "9544.52000000", + "1680.72604000", + 1590843599999, + "16023102.56802568", + 21740, + "764.62206800", + "7288396.35940973", + "0" + ], + [ + 1590843600000, + "9544.95000000", + "9566.00000000", + "9521.00000000", + "9563.79000000", + "1548.87595400", + 1590847199999, + "14780886.76589297", + 23132, + "785.63639800", + "7497823.48796485", + "0" + ], + [ + 1590847200000, + "9563.79000000", + "9570.00000000", + "9536.60000000", + "9546.77000000", + "2777.82936300", + 1590850799999, + "26535704.62152478", + 29011, + "1902.07168600", + "18170169.50677575", + "0" + ], + [ + 1590850800000, + "9546.58000000", + "9549.57000000", + "9495.00000000", + "9540.60000000", + "2145.05724100", + 1590854399999, + "20415310.08334526", + 25510, + "1088.32423500", + "10360023.91962201", + "0" + ], + [ + 1590854400000, + "9540.60000000", + "9554.98000000", + "9512.04000000", + "9539.49000000", + "1614.99816800", + 1590857999999, + "15401361.70670354", + 26549, + "733.38830500", + "6994233.95754210", + "0" + ], + [ + 1590858000000, + "9540.00000000", + "9545.00000000", + "9515.00000000", + "9523.82000000", + "1308.78605400", + 1590861599999, + "12469157.18176247", + 19281, + "596.51319500", + "5683005.28794428", + "0" + ], + [ + 1590861600000, + "9523.11000000", + "9545.96000000", + "9515.00000000", + "9530.00000000", + "1214.86069000", + 1590865199999, + "11580602.50298175", + 18313, + "615.81368000", + "5870084.97409603", + "0" + ], + [ + 1590865200000, + "9530.01000000", + "9542.74000000", + "9515.00000000", + "9535.14000000", + "975.92237600", + 1590868799999, + "9300963.15625158", + 14170, + "486.13966800", + "4633224.96906840", + "0" + ], + [ + 1590868800000, + "9535.13000000", + "9540.00000000", + "9400.00000000", + "9440.61000000", + "3876.79202100", + 1590872399999, + "36662062.66580845", + 40871, + "1545.01896100", + "14611591.09493165", + "0" + ], + [ + 1590872400000, + "9440.46000000", + "9500.00000000", + "9432.07000000", + "9491.41000000", + "1410.22083600", + 1590875999999, + "13336518.86155832", + 23091, + "640.84988400", + "6061663.38402781", + "0" + ], + [ + 1590876000000, + "9492.44000000", + "9730.00000000", + "9470.07000000", + "9729.00000000", + "7362.23509100", + 1590879599999, + "70927923.83582177", + 70061, + "4624.95718000", + "44564042.59627184", + "0" + ], + [ + 1590879600000, + "9729.00000000", + "9740.00000000", + "9636.96000000", + "9697.72000000", + "3349.13851700", + 1590883199999, + "32460436.88056162", + 38108, + "1662.76272200", + "16117460.45196281", + "0" + ], + [ + 1590883200000, + "9697.72000000", + "9700.00000000", + "9635.84000000", + "9656.67000000", + "1915.26907200", + 1590886799999, + "18509394.06822930", + 27389, + "994.69860400", + "9613831.29702528", + "0" + ], + [ + 1590886800000, + "9656.64000000", + "9678.75000000", + "9631.40000000", + "9657.20000000", + "1759.46180400", + 1590890399999, + "16985972.82092938", + 23327, + "793.96977600", + "7666189.84876307", + "0" + ], + [ + 1590890400000, + "9657.20000000", + "9657.21000000", + "9612.00000000", + "9640.76000000", + "1777.42168500", + 1590893999999, + "17125977.05920156", + 21588, + "945.62497400", + "9111454.88397448", + "0" + ], + [ + 1590894000000, + "9641.64000000", + "9656.00000000", + "9552.92000000", + "9576.79000000", + "2986.49116300", + 1590897599999, + "28700278.28937011", + 31291, + "1540.52852300", + "14807554.49440211", + "0" + ], + [ + 1590897600000, + "9576.78000000", + "9600.00000000", + "9516.38000000", + "9555.84000000", + "2406.18643200", + 1590901199999, + "23003951.92516109", + 27236, + "1028.81863100", + "9837397.73888708", + "0" + ], + [ + 1590901200000, + "9555.84000000", + "9613.65000000", + "9551.61000000", + "9570.94000000", + "1836.87424000", + 1590904799999, + "17598127.69473129", + 22651, + "811.66598600", + "7775636.34604339", + "0" + ], + [ + 1590904800000, + "9570.94000000", + "9582.31000000", + "9545.00000000", + "9549.63000000", + "1297.14483800", + 1590908399999, + "12406383.15078115", + 17582, + "628.86754300", + "6015026.56922775", + "0" + ], + [ + 1590908400000, + "9549.62000000", + "9589.31000000", + "9520.70000000", + "9565.13000000", + "1591.16609400", + 1590911999999, + "15226632.88083015", + 26982, + "811.27801100", + "7763768.83335560", + "0" + ], + [ + 1590912000000, + "9565.13000000", + "9582.75000000", + "9525.00000000", + "9539.17000000", + "1691.17997700", + 1590915599999, + "16152880.58338296", + 26208, + "759.06468400", + "7249478.81255633", + "0" + ], + [ + 1590915600000, + "9539.18000000", + "9568.77000000", + "9500.00000000", + "9561.24000000", + "1931.56301900", + 1590919199999, + "18430964.24173914", + 25976, + "917.72235200", + "8759365.22341188", + "0" + ], + [ + 1590919200000, + "9561.23000000", + "9605.69000000", + "9546.98000000", + "9599.20000000", + "1935.08360500", + 1590922799999, + "18530642.69258506", + 26231, + "1046.64600900", + "10024090.78360397", + "0" + ], + [ + 1590922800000, + "9599.25000000", + "9601.16000000", + "9564.91000000", + "9588.96000000", + "1521.50673700", + 1590926399999, + "14578968.29015273", + 23071, + "736.52499700", + "7057186.77943875", + "0" + ], + [ + 1590926400000, + "9588.95000000", + "9638.00000000", + "9555.00000000", + "9576.22000000", + "2665.22382400", + 1590929999999, + "25563287.41817848", + 33046, + "1210.36922800", + "11611686.93108826", + "0" + ], + [ + 1590930000000, + "9576.52000000", + "9596.28000000", + "9523.00000000", + "9547.20000000", + "2238.45287800", + 1590933599999, + "21397627.75846910", + 30941, + "1122.96832800", + "10734179.86997710", + "0" + ], + [ + 1590933600000, + "9547.15000000", + "9563.49000000", + "9457.00000000", + "9471.11000000", + "2993.23245800", + 1590937199999, + "28495121.50258368", + 39681, + "1268.13860200", + "12077395.47763033", + "0" + ], + [ + 1590937200000, + "9471.12000000", + "9499.17000000", + "9436.96000000", + "9480.00000000", + "3160.09979900", + 1590940799999, + "29924999.43685085", + 38073, + "1443.72723100", + "13674126.96067209", + "0" + ], + [ + 1590940800000, + "9480.41000000", + "9536.09000000", + "9460.00000000", + "9531.04000000", + "2290.54311200", + 1590944399999, + "21777196.08982599", + 31039, + "1040.76172100", + "9894953.77426031", + "0" + ], + [ + 1590944400000, + "9531.04000000", + "9534.98000000", + "9490.54000000", + "9503.97000000", + "1562.28597400", + 1590947999999, + "14865059.79876412", + 20753, + "685.68729200", + "6523622.83899252", + "0" + ], + [ + 1590948000000, + "9503.94000000", + "9511.68000000", + "9465.24000000", + "9501.05000000", + "1385.99792700", + 1590951599999, + "13156843.42260502", + 19137, + "606.99913700", + "5762917.94560586", + "0" + ], + [ + 1590951600000, + "9500.52000000", + "9536.69000000", + "9482.44000000", + "9514.74000000", + "1104.27547000", + 1590955199999, + "10509518.04645744", + 17981, + "524.52930300", + "4991920.37410740", + "0" + ], + [ + 1590955200000, + "9514.73000000", + "9525.22000000", + "9487.58000000", + "9506.60000000", + "994.07296200", + 1590958799999, + "9448389.15092099", + 17492, + "512.17328900", + "4868084.74700618", + "0" + ], + [ + 1590958800000, + "9506.52000000", + "9506.74000000", + "9419.31000000", + "9469.35000000", + "1882.02319100", + 1590962399999, + "17804722.40133334", + 33794, + "796.24999200", + "7533507.96870147", + "0" + ], + [ + 1590962400000, + "9469.35000000", + "9524.00000000", + "9421.00000000", + "9461.60000000", + "1999.70161900", + 1590965999999, + "18945454.88209850", + 26689, + "943.69100700", + "8941701.97889031", + "0" + ], + [ + 1590966000000, + "9461.47000000", + "9485.63000000", + "9381.41000000", + "9448.27000000", + "3408.52852300", + 1590969599999, + "32133905.24733911", + 43315, + "1607.29594900", + "15155084.54044180", + "0" + ], + [ + 1590969600000, + "9448.27000000", + "9508.57000000", + "9421.67000000", + "9498.31000000", + "1742.12591700", + 1590973199999, + "16506416.24100491", + 26648, + "950.04793300", + "9001264.67142507", + "0" + ], + [ + 1590973200000, + "9498.78000000", + "9570.00000000", + "9465.30000000", + "9551.58000000", + "2064.37821000", + 1590976799999, + "19637784.85511167", + 26896, + "1101.77221800", + "10484103.68535745", + "0" + ], + [ + 1590976800000, + "9551.17000000", + "9568.61000000", + "9526.87000000", + "9530.67000000", + "1984.95672800", + 1590980399999, + "18949291.50262529", + 23950, + "771.80332100", + "7367396.77542866", + "0" + ], + [ + 1590980400000, + "9531.70000000", + "9571.66000000", + "9514.65000000", + "9555.79000000", + "1620.63897800", + 1590983999999, + "15463309.49102828", + 20098, + "863.40303700", + "8236463.82773316", + "0" + ], + [ + 1590984000000, + "9556.14000000", + "9619.00000000", + "9541.96000000", + "9549.02000000", + "2787.51221900", + 1590987599999, + "26691829.16923142", + 28674, + "1353.22971500", + "12959226.80415797", + "0" + ], + [ + 1590987600000, + "9549.02000000", + "9566.00000000", + "9526.20000000", + "9536.88000000", + "1411.85289800", + 1590991199999, + "13476298.45383985", + 20149, + "715.79763800", + "6832462.96556232", + "0" + ], + [ + 1590991200000, + "9536.33000000", + "9561.00000000", + "9529.24000000", + "9537.66000000", + "1508.97167600", + 1590994799999, + "14403405.09634614", + 21022, + "735.85001800", + "7024405.72300943", + "0" + ], + [ + 1590994800000, + "9537.66000000", + "9584.37000000", + "9536.65000000", + "9571.47000000", + "1831.00475200", + 1590998399999, + "17505835.21839432", + 23447, + "778.27001600", + "7440170.08744190", + "0" + ], + [ + 1590998400000, + "9571.18000000", + "9581.99000000", + "9530.00000000", + "9540.30000000", + "1599.64635500", + 1591001999999, + "15279583.63079230", + 20852, + "652.14121700", + "6229352.03249567", + "0" + ], + [ + 1591002000000, + "9540.54000000", + "9561.69000000", + "9528.62000000", + "9541.21000000", + "1441.31895500", + 1591005599999, + "13756029.33889841", + 22170, + "745.64371100", + "7116821.86504590", + "0" + ], + [ + 1591005600000, + "9541.71000000", + "9550.00000000", + "9513.36000000", + "9543.24000000", + "1575.79727700", + 1591009199999, + "15021657.69809053", + 19588, + "712.02655000", + "6787970.85103837", + "0" + ], + [ + 1591009200000, + "9542.32000000", + "9552.14000000", + "9511.00000000", + "9513.22000000", + "1424.18373200", + 1591012799999, + "13571042.97763715", + 18457, + "601.79662600", + "5734440.90775628", + "0" + ], + [ + 1591012800000, + "9512.80000000", + "9590.26000000", + "9491.45000000", + "9555.01000000", + "3042.94078800", + 1591016399999, + "29064040.81245435", + 31485, + "1605.77912900", + "15342963.48469543", + "0" + ], + [ + 1591016400000, + "9555.65000000", + "9571.99000000", + "9543.64000000", + "9553.62000000", + "1266.84989200", + 1591019999999, + "12110808.69189481", + 19748, + "626.81270400", + "5992514.38646544", + "0" + ], + [ + 1591020000000, + "9553.14000000", + "9580.72000000", + "9547.06000000", + "9563.03000000", + "1924.36524700", + 1591023599999, + "18404982.66467223", + 23839, + "1026.40618800", + "9816773.92733582", + "0" + ], + [ + 1591023600000, + "9563.13000000", + "9565.43000000", + "9500.00000000", + "9546.98000000", + "1915.78482300", + 1591027199999, + "18252231.99039594", + 23906, + "841.29810200", + "8015935.42246254", + "0" + ], + [ + 1591027200000, + "9548.18000000", + "9610.00000000", + "9536.99000000", + "9584.28000000", + "3086.58491700", + 1591030799999, + "29559800.22033365", + 31181, + "1794.42943700", + "17187595.14023852", + "0" + ], + [ + 1591030800000, + "9584.29000000", + "9592.59000000", + "9563.26000000", + "9575.29000000", + "1176.97733300", + 1591034399999, + "11272597.95411883", + 15963, + "613.06053600", + "5871820.13342533", + "0" + ], + [ + 1591034400000, + "9575.29000000", + "9587.01000000", + "9555.24000000", + "9579.70000000", + "996.49970900", + 1591037999999, + "9538423.88135709", + 15982, + "506.22329200", + "4845789.44661181", + "0" + ], + [ + 1591038000000, + "9579.97000000", + "9612.76000000", + "9561.29000000", + "9572.48000000", + "1688.49846700", + 1591041599999, + "16189051.39699757", + 20845, + "795.65223400", + "7629987.69913759", + "0" + ], + [ + 1591041600000, + "9572.50000000", + "9688.00000000", + "9558.57000000", + "9668.71000000", + "3151.00221300", + 1591045199999, + "30358357.67358629", + 36411, + "1869.67327600", + "18018758.01897118", + "0" + ], + [ + 1591045200000, + "9670.00000000", + "9700.00000000", + "9626.93000000", + "9653.00000000", + "2704.78653700", + 1591048799999, + "26139685.74398589", + 28333, + "1469.86923000", + "14205165.81096584", + "0" + ], + [ + 1591048800000, + "9653.00000000", + "9746.83000000", + "9652.44000000", + "9739.51000000", + "4024.16302900", + 1591052399999, + "39046927.64715984", + 37517, + "2203.46084600", + "21382864.80491460", + "0" + ], + [ + 1591052400000, + "9740.00000000", + "10380.00000000", + "9739.99000000", + "10200.77000000", + "30678.28630800", + 1591055999999, + "309508204.30940055", + 269803, + "18195.96534300", + "183252940.81147358", + "0" + ], + [ + 1591056000000, + "10202.71000000", + "10228.99000000", + "10088.45000000", + "10108.49000000", + "9036.25789300", + 1591059599999, + "91818607.31799005", + 83149, + "5131.31667900", + "52139183.43433323", + "0" + ], + [ + 1591059600000, + "10108.79000000", + "10130.50000000", + "10058.41000000", + "10125.00000000", + "7354.39707600", + 1591063199999, + "74278184.12715071", + 52137, + "3829.72560300", + "38680482.28583896", + "0" + ], + [ + 1591063200000, + "10124.99000000", + "10125.00000000", + "10051.00000000", + "10090.76000000", + "4485.11220100", + 1591066799999, + "45302013.19641947", + 33566, + "2668.33532900", + "26951090.62281393", + "0" + ], + [ + 1591066800000, + "10090.34000000", + "10105.91000000", + "10041.59000000", + "10096.86000000", + "2970.16144700", + 1591070399999, + "29919965.60397538", + 28715, + "1626.59023500", + "16389065.96840458", + "0" + ], + [ + 1591070400000, + "10096.87000000", + "10115.08000000", + "10070.03000000", + "10093.31000000", + "2227.99291800", + 1591073999999, + "22488857.29207256", + 25705, + "1202.96234900", + "12143936.90452706", + "0" + ], + [ + 1591074000000, + "10093.97000000", + "10123.11000000", + "10070.11000000", + "10085.55000000", + "2900.44726900", + 1591077599999, + "29281603.45466253", + 30077, + "1233.64820700", + "12456150.18256408", + "0" + ], + [ + 1591077600000, + "10086.43000000", + "10134.27000000", + "10080.00000000", + "10100.11000000", + "2959.97341400", + 1591081199999, + "29918904.68553327", + 31014, + "1337.81086600", + "13524008.37523099", + "0" + ], + [ + 1591081200000, + "10100.03000000", + "10128.94000000", + "10090.00000000", + "10118.86000000", + "2389.64082400", + 1591084799999, + "24156666.16392340", + 26672, + "1155.42886900", + "11679823.36644728", + "0" + ], + [ + 1591084800000, + "10119.12000000", + "10156.78000000", + "10102.00000000", + "10107.48000000", + "3193.17658200", + 1591088399999, + "32336830.06786182", + 32652, + "1650.81632700", + "16719851.99710963", + "0" + ], + [ + 1591088400000, + "10107.25000000", + "10128.32000000", + "10090.00000000", + "10100.55000000", + "2507.12136100", + 1591091999999, + "25352042.37376125", + 26747, + "1137.98429000", + "11507149.85417151", + "0" + ], + [ + 1591092000000, + "10100.55000000", + "10143.00000000", + "10096.48000000", + "10141.25000000", + "2669.67432600", + 1591095599999, + "27017176.32309311", + 30421, + "1298.90300600", + "13146445.69905842", + "0" + ], + [ + 1591095600000, + "10140.77000000", + "10147.53000000", + "10100.00000000", + "10115.56000000", + "2837.55135600", + 1591099199999, + "28704628.06968529", + 28787, + "1172.10895500", + "11856900.42666101", + "0" + ], + [ + 1591099200000, + "10116.68000000", + "10136.82000000", + "10110.00000000", + "10123.71000000", + "2584.17821000", + 1591102799999, + "26155134.16156638", + 27763, + "1042.69553600", + "10554046.04147470", + "0" + ], + [ + 1591102800000, + "10123.71000000", + "10190.00000000", + "10122.00000000", + "10155.96000000", + "3193.47201700", + 1591106399999, + "32446913.54563984", + 33026, + "1472.42647000", + "14959553.96658084", + "0" + ], + [ + 1591106400000, + "10155.96000000", + "10183.27000000", + "9400.00000000", + "9581.47000000", + "17137.36278100", + 1591109999999, + "166622397.56973851", + 137868, + "6214.90170400", + "60278335.71103070", + "0" + ], + [ + 1591110000000, + "9582.17000000", + "9600.00000000", + "9266.00000000", + "9468.81000000", + "19661.29601900", + 1591113599999, + "186185468.83374651", + 139085, + "8089.93396800", + "76663449.37397080", + "0" + ], + [ + 1591113600000, + "9468.08000000", + "9515.24000000", + "9424.17000000", + "9478.29000000", + "5793.04958000", + 1591117199999, + "54852571.67515558", + 52810, + "2193.42578600", + "20778859.03901930", + "0" + ], + [ + 1591117200000, + "9478.03000000", + "9539.00000000", + "9460.00000000", + "9530.71000000", + "2873.13003400", + 1591120799999, + "27289589.86617576", + 31698, + "1398.15164700", + "13281264.70933780", + "0" + ], + [ + 1591120800000, + "9530.55000000", + "9540.00000000", + "9487.43000000", + "9513.04000000", + "2233.23532800", + 1591124399999, + "21250036.29839604", + 26633, + "1003.29479300", + "9547478.16923504", + "0" + ], + [ + 1591124400000, + "9513.04000000", + "9535.00000000", + "9490.00000000", + "9508.83000000", + "1732.32811900", + 1591127999999, + "16483575.50022517", + 23039, + "842.31933500", + "8015012.21607263", + "0" + ], + [ + 1591128000000, + "9507.69000000", + "9529.37000000", + "9451.00000000", + "9521.00000000", + "2112.46881800", + 1591131599999, + "20047462.43861243", + 24631, + "991.39679400", + "9407850.86791325", + "0" + ], + [ + 1591131600000, + "9521.00000000", + "9551.80000000", + "9507.85000000", + "9522.00000000", + "1486.21206900", + 1591135199999, + "14163933.32460313", + 23434, + "647.09156800", + "6167335.96546805", + "0" + ], + [ + 1591135200000, + "9522.00000000", + "9552.91000000", + "9400.00000000", + "9493.42000000", + "2636.46128000", + 1591138799999, + "25026866.97942239", + 28828, + "1082.21511600", + "10276548.60953586", + "0" + ], + [ + 1591138800000, + "9493.35000000", + "9542.22000000", + "9460.00000000", + "9518.04000000", + "1996.07222900", + 1591142399999, + "18960808.26079874", + 25855, + "931.42453700", + "8849288.40671927", + "0" + ], + [ + 1591142400000, + "9518.02000000", + "9540.00000000", + "9496.00000000", + "9527.20000000", + "1549.41770100", + 1591145999999, + "14751181.53577639", + 22389, + "752.21220800", + "7162436.77821022", + "0" + ], + [ + 1591146000000, + "9527.33000000", + "9530.00000000", + "9491.00000000", + "9504.17000000", + "1303.59083500", + 1591149599999, + "12394611.02686867", + 17602, + "615.69812000", + "5855069.91429407", + "0" + ], + [ + 1591149600000, + "9504.12000000", + "9515.77000000", + "9469.63000000", + "9489.63000000", + "1587.68256200", + 1591153199999, + "15075228.26804903", + 22970, + "725.86274200", + "6892282.12040587", + "0" + ], + [ + 1591153200000, + "9489.62000000", + "9502.00000000", + "9481.29000000", + "9491.99000000", + "1111.87615500", + 1591156799999, + "10552755.01834095", + 15026, + "451.28355200", + "4283123.25637165", + "0" + ], + [ + 1591156800000, + "9491.58000000", + "9523.83000000", + "9477.17000000", + "9497.15000000", + "1367.19383200", + 1591160399999, + "12995366.88548023", + 18022, + "625.28229000", + "5944024.30508351", + "0" + ], + [ + 1591160400000, + "9497.63000000", + "9528.42000000", + "9365.21000000", + "9515.00000000", + "3552.86935200", + 1591163999999, + "33647051.57466072", + 36307, + "1650.21502400", + "15635754.60133546", + "0" + ], + [ + 1591164000000, + "9514.99000000", + "9530.00000000", + "9498.89000000", + "9517.63000000", + "1350.08417200", + 1591167599999, + "12848088.57882951", + 16581, + "529.02188500", + "5034501.32369275", + "0" + ], + [ + 1591167600000, + "9517.64000000", + "9539.00000000", + "9485.98000000", + "9506.32000000", + "1781.40739800", + 1591171199999, + "16945860.88404903", + 20218, + "809.52385500", + "7702494.80105826", + "0" + ], + [ + 1591171200000, + "9506.94000000", + "9531.34000000", + "9492.06000000", + "9507.00000000", + "1534.20418500", + 1591174799999, + "14601979.92107394", + 17022, + "689.11663600", + "6559226.36734940", + "0" + ], + [ + 1591174800000, + "9506.84000000", + "9538.00000000", + "9500.79000000", + "9523.79000000", + "1408.90567100", + 1591178399999, + "13416332.88938000", + 18959, + "686.35910000", + "6535816.70744348", + "0" + ], + [ + 1591178400000, + "9523.07000000", + "9622.01000000", + "9522.18000000", + "9591.07000000", + "4149.25431400", + 1591181999999, + "39754500.21999386", + 39580, + "2280.74583100", + "21849664.35413727", + "0" + ], + [ + 1591182000000, + "9591.77000000", + "9620.12000000", + "9568.20000000", + "9618.57000000", + "2172.81609000", + 1591185599999, + "20839521.27528218", + 25438, + "1060.73128600", + "10173265.43277269", + "0" + ], + [ + 1591185600000, + "9617.92000000", + "9646.43000000", + "9549.66000000", + "9598.29000000", + "3031.26806100", + 1591189199999, + "29103595.44030959", + 34167, + "1358.96383800", + "13048564.09707863", + "0" + ], + [ + 1591189200000, + "9597.61000000", + "9614.00000000", + "9577.00000000", + "9584.80000000", + "1862.93386000", + 1591192799999, + "17872313.53124663", + 22853, + "843.12289000", + "8088719.59414594", + "0" + ], + [ + 1591192800000, + "9583.82000000", + "9597.55000000", + "9486.05000000", + "9580.71000000", + "3116.27977900", + 1591196399999, + "29749809.34948530", + 33073, + "1578.24484100", + "15064228.39994480", + "0" + ], + [ + 1591196400000, + "9580.71000000", + "9593.49000000", + "9520.03000000", + "9559.29000000", + "2110.61321700", + 1591199999999, + "20185007.38840159", + 27805, + "968.75239800", + "9266126.50529744", + "0" + ], + [ + 1591200000000, + "9560.17000000", + "9590.00000000", + "9544.97000000", + "9561.03000000", + "1776.48511800", + 1591203599999, + "16994667.63938738", + 26345, + "1008.50550600", + "9647770.69126606", + "0" + ], + [ + 1591203600000, + "9561.27000000", + "9580.00000000", + "9551.25000000", + "9560.01000000", + "1406.70860800", + 1591207199999, + "13458826.08021165", + 18563, + "748.18944600", + "7158346.25390501", + "0" + ], + [ + 1591207200000, + "9560.02000000", + "9615.00000000", + "9534.82000000", + "9596.31000000", + "2112.49544300", + 1591210799999, + "20238266.61365450", + 26951, + "1358.20958400", + "13011357.51146118", + "0" + ], + [ + 1591210800000, + "9597.12000000", + "9622.44000000", + "9529.00000000", + "9577.18000000", + "2082.76481600", + 1591214399999, + "19960114.36936235", + 26066, + "944.78609600", + "9056120.74757248", + "0" + ], + [ + 1591214400000, + "9577.18000000", + "9588.09000000", + "9558.24000000", + "9581.53000000", + "827.43652300", + 1591217999999, + "7922014.14700632", + 15041, + "367.93733700", + "3522791.86680077", + "0" + ], + [ + 1591218000000, + "9581.36000000", + "9599.49000000", + "9567.43000000", + "9583.06000000", + "678.99643600", + 1591221599999, + "6506729.94991917", + 13584, + "324.66754600", + "3111204.46862395", + "0" + ], + [ + 1591221600000, + "9583.07000000", + "9615.34000000", + "9559.05000000", + "9610.63000000", + "1550.16934300", + 1591225199999, + "14865972.93832934", + 19118, + "693.74693500", + "6652214.39071118", + "0" + ], + [ + 1591225200000, + "9611.43000000", + "9690.00000000", + "9593.34000000", + "9666.24000000", + "2827.19146800", + 1591228799999, + "27249022.51791728", + 29104, + "1585.12920400", + "15282453.52788912", + "0" + ], + [ + 1591228800000, + "9666.32000000", + "9674.83000000", + "9600.01000000", + "9630.03000000", + "1527.95912500", + 1591232399999, + "14724844.71612871", + 21304, + "670.43719700", + "6462016.57593016", + "0" + ], + [ + 1591232400000, + "9629.78000000", + "9669.00000000", + "9628.14000000", + "9641.94000000", + "1280.14391300", + 1591235999999, + "12354104.33943148", + 22371, + "624.62687300", + "6027931.74569320", + "0" + ], + [ + 1591236000000, + "9641.93000000", + "9685.71000000", + "9630.00000000", + "9670.00000000", + "1398.54660900", + 1591239599999, + "13514616.89418848", + 22038, + "679.91822500", + "6570543.06822200", + "0" + ], + [ + 1591239600000, + "9670.00000000", + "9687.93000000", + "9651.95000000", + "9665.37000000", + "1631.11530200", + 1591243199999, + "15775554.51256166", + 20152, + "809.85051900", + "7832599.32245423", + "0" + ], + [ + 1591243200000, + "9665.36000000", + "9677.46000000", + "9622.58000000", + "9645.07000000", + "1703.93358600", + 1591246799999, + "16450084.04896376", + 21740, + "843.03184700", + "8141103.18809125", + "0" + ], + [ + 1591246800000, + "9644.65000000", + "9656.27000000", + "9625.92000000", + "9642.56000000", + "1165.99011500", + 1591250399999, + "11241215.18881813", + 16704, + "643.41456500", + "6203121.47646254", + "0" + ], + [ + 1591250400000, + "9642.55000000", + "9658.88000000", + "9617.27000000", + "9644.90000000", + "1441.34540900", + 1591253999999, + "13894279.15634392", + 20399, + "643.04740800", + "6198896.58971777", + "0" + ], + [ + 1591254000000, + "9644.87000000", + "9669.49000000", + "9643.41000000", + "9649.60000000", + "1633.95706800", + 1591257599999, + "15778757.45987304", + 20583, + "713.28724400", + "6887972.66805343", + "0" + ], + [ + 1591257600000, + "9649.59000000", + "9652.03000000", + "9614.23000000", + "9642.22000000", + "1681.72391000", + 1591261199999, + "16204502.28742784", + 19910, + "666.88415000", + "6426407.73673916", + "0" + ], + [ + 1591261200000, + "9642.22000000", + "9642.67000000", + "9506.76000000", + "9562.19000000", + "3345.73903500", + 1591264799999, + "31994480.77531157", + 40360, + "1382.55048800", + "13218755.31985048", + "0" + ], + [ + 1591264800000, + "9562.49000000", + "9564.42000000", + "9510.14000000", + "9547.72000000", + "2559.67016900", + 1591268399999, + "24416079.98579002", + 27248, + "1342.58458000", + "12807446.60265941", + "0" + ], + [ + 1591268400000, + "9547.53000000", + "9653.27000000", + "9450.00000000", + "9622.08000000", + "5292.16659900", + 1591271999999, + "50561525.62453352", + 57397, + "2418.68247000", + "23127851.69889470", + "0" + ], + [ + 1591272000000, + "9622.18000000", + "9683.10000000", + "9605.00000000", + "9642.02000000", + "2731.27068100", + 1591275599999, + "26342685.17567190", + 33571, + "1435.36055400", + "13845300.71598248", + "0" + ], + [ + 1591275600000, + "9642.60000000", + "9793.36000000", + "9636.50000000", + "9762.28000000", + "5682.35616500", + 1591279199999, + "55290872.39073603", + 52938, + "3367.33807500", + "32768173.48263218", + "0" + ], + [ + 1591279200000, + "9762.28000000", + "9780.00000000", + "9717.10000000", + "9746.63000000", + "3428.61139700", + 1591282799999, + "33427993.51224016", + 33631, + "1753.00355800", + "17090803.65920991", + "0" + ], + [ + 1591282800000, + "9746.46000000", + "9840.79000000", + "9720.47000000", + "9829.39000000", + "3508.80191800", + 1591286399999, + "34293369.62277751", + 33151, + "2132.71163400", + "20850368.94074244", + "0" + ], + [ + 1591286400000, + "9829.40000000", + "9856.56000000", + "9752.13000000", + "9770.31000000", + "3058.42076200", + 1591289999999, + "29951997.71467125", + 32715, + "1567.42303900", + "15354723.27082232", + "0" + ], + [ + 1591290000000, + "9770.58000000", + "9826.08000000", + "9770.31000000", + "9818.95000000", + "2143.81686800", + 1591293599999, + "21001376.66555470", + 21367, + "1196.33322200", + "11719568.31557690", + "0" + ], + [ + 1591293600000, + "9818.95000000", + "9881.63000000", + "9725.00000000", + "9762.71000000", + "4171.77571200", + 1591297199999, + "40993198.74289402", + 41561, + "1848.35900300", + "18166762.66567973", + "0" + ], + [ + 1591297200000, + "9764.72000000", + "9825.87000000", + "9759.24000000", + "9817.64000000", + "1564.09834000", + 1591300799999, + "15315147.38062070", + 21658, + "790.67945400", + "7743123.68228872", + "0" + ], + [ + 1591300800000, + "9817.65000000", + "9827.38000000", + "9740.87000000", + "9781.27000000", + "2062.16756400", + 1591304399999, + "20175548.40501683", + 25831, + "1103.37531300", + "10797031.23797092", + "0" + ], + [ + 1591304400000, + "9781.27000000", + "9784.21000000", + "9728.10000000", + "9780.00000000", + "1030.11906300", + 1591307999999, + "10054806.19969382", + 16622, + "489.27517100", + "4776489.97652563", + "0" + ], + [ + 1591308000000, + "9780.00000000", + "9839.31000000", + "9750.96000000", + "9814.60000000", + "1595.62189500", + 1591311599999, + "15635765.51149316", + 19825, + "753.45000400", + "7381785.03730065", + "0" + ], + [ + 1591311600000, + "9814.60000000", + "9860.00000000", + "9780.16000000", + "9789.06000000", + "1816.74976400", + 1591315199999, + "17842139.33599665", + 22805, + "902.61277800", + "8865147.73032884", + "0" + ], + [ + 1591315200000, + "9788.14000000", + "9817.71000000", + "9755.82000000", + "9803.19000000", + "1273.44015100", + 1591318799999, + "12465979.95054268", + 17899, + "627.00963900", + "6138586.19415275", + "0" + ], + [ + 1591318800000, + "9804.05000000", + "9846.16000000", + "9800.00000000", + "9823.35000000", + "1360.13594600", + 1591322399999, + "13357326.08179668", + 19346, + "641.26586500", + "6297522.05239090", + "0" + ], + [ + 1591322400000, + "9822.95000000", + "9832.56000000", + "9788.00000000", + "9798.49000000", + "1139.34545000", + 1591325999999, + "11176140.87926958", + 14643, + "524.71037900", + "5146898.68542558", + "0" + ], + [ + 1591326000000, + "9798.05000000", + "9833.35000000", + "9750.00000000", + "9796.59000000", + "1481.81900600", + 1591329599999, + "14511531.62900277", + 19957, + "689.63053500", + "6754853.65694402", + "0" + ], + [ + 1591329600000, + "9797.04000000", + "9826.33000000", + "9757.49000000", + "9783.70000000", + "1330.48052900", + 1591333199999, + "13027784.48694883", + 17741, + "612.92449500", + "6002673.22637458", + "0" + ], + [ + 1591333200000, + "9784.53000000", + "9807.41000000", + "9774.50000000", + "9790.41000000", + "1378.19890800", + 1591336799999, + "13497758.70110635", + 14628, + "682.02099100", + "6679227.81310951", + "0" + ], + [ + 1591336800000, + "9790.00000000", + "9806.29000000", + "9725.00000000", + "9799.21000000", + "1927.31863400", + 1591340399999, + "18836083.04257424", + 23006, + "895.49711800", + "8756080.37492477", + "0" + ], + [ + 1591340400000, + "9799.20000000", + "9799.20000000", + "9750.10000000", + "9774.64000000", + "1365.82028300", + 1591343999999, + "13348842.92194711", + 17373, + "698.76359300", + "6829500.52216941", + "0" + ], + [ + 1591344000000, + "9774.27000000", + "9854.75000000", + "9631.77000000", + "9833.43000000", + "6418.68689900", + 1591347599999, + "62718684.41026479", + 54042, + "3360.39066900", + "32862633.84277615", + "0" + ], + [ + 1591347600000, + "9833.44000000", + "9840.62000000", + "9800.97000000", + "9824.46000000", + "1558.13540400", + 1591351199999, + "15301502.85462257", + 20196, + "650.26306700", + "6386433.12320014", + "0" + ], + [ + 1591351200000, + "9824.46000000", + "9824.99000000", + "9670.00000000", + "9700.34000000", + "4230.39371500", + 1591354799999, + "41187619.71321736", + 43328, + "1695.22422100", + "16504055.76082301", + "0" + ], + [ + 1591354800000, + "9700.32000000", + "9741.58000000", + "9581.00000000", + "9696.60000000", + "3843.55459500", + 1591358399999, + "37186053.29947185", + 39725, + "1714.43173900", + "16600615.53211107", + "0" + ], + [ + 1591358400000, + "9697.79000000", + "9727.97000000", + "9624.24000000", + "9672.88000000", + "3270.20415100", + 1591361999999, + "31653357.10380857", + 33059, + "1498.06076500", + "14504307.67768767", + "0" + ], + [ + 1591362000000, + "9672.89000000", + "9726.01000000", + "9649.00000000", + "9712.36000000", + "2436.47920300", + 1591365599999, + "23612116.38043114", + 26795, + "1094.08136900", + "10603093.73528723", + "0" + ], + [ + 1591365600000, + "9713.15000000", + "9720.00000000", + "9676.06000000", + "9689.07000000", + "1909.16505600", + 1591369199999, + "18523885.07384463", + 26587, + "734.94951900", + "7130618.09014103", + "0" + ], + [ + 1591369200000, + "9689.21000000", + "9718.70000000", + "9652.01000000", + "9711.75000000", + "1726.71693700", + 1591372799999, + "16722755.18567519", + 25442, + "781.99363000", + "7573576.30004189", + "0" + ], + [ + 1591372800000, + "9711.76000000", + "9738.16000000", + "9693.13000000", + "9725.03000000", + "1770.64829500", + 1591376399999, + "17208510.06273160", + 23340, + "835.60341500", + "8122094.72931924", + "0" + ], + [ + 1591376400000, + "9725.19000000", + "9755.82000000", + "9717.52000000", + "9724.58000000", + "1585.78548900", + 1591379999999, + "15440639.73526429", + 20268, + "752.46263600", + "7327002.29699556", + "0" + ], + [ + 1591380000000, + "9724.57000000", + "9753.12000000", + "9720.01000000", + "9739.77000000", + "1337.12585600", + 1591383599999, + "13017592.15290942", + 15567, + "738.00671300", + "7184503.28327466", + "0" + ], + [ + 1591383600000, + "9740.79000000", + "9749.71000000", + "9700.00000000", + "9725.00000000", + "1355.00483500", + 1591387199999, + "13173588.36950547", + 17283, + "658.71506300", + "6404130.36726396", + "0" + ], + [ + 1591387200000, + "9724.99000000", + "9735.43000000", + "9681.62000000", + "9714.22000000", + "1050.14369700", + 1591390799999, + "10192545.73873391", + 16745, + "511.32365000", + "4962404.50011776", + "0" + ], + [ + 1591390800000, + "9714.22000000", + "9715.54000000", + "9653.53000000", + "9669.23000000", + "1376.08904600", + 1591394399999, + "13326744.27619227", + 20642, + "761.41496800", + "7372844.95649082", + "0" + ], + [ + 1591394400000, + "9669.23000000", + "9690.00000000", + "9630.68000000", + "9679.74000000", + "1171.33185800", + 1591397999999, + "11317771.00383566", + 18725, + "488.78532300", + "4724051.68053485", + "0" + ], + [ + 1591398000000, + "9679.74000000", + "9683.92000000", + "9619.47000000", + "9621.16000000", + "1492.02610700", + 1591401599999, + "14395975.14993688", + 19725, + "681.57775700", + "6576760.54897195", + "0" + ], + [ + 1591401600000, + "9621.17000000", + "9621.17000000", + "9531.05000000", + "9600.47000000", + "3843.06776000", + 1591405199999, + "36813073.08761853", + 37787, + "1539.68678600", + "14748165.80351843", + "0" + ], + [ + 1591405200000, + "9601.26000000", + "9621.94000000", + "9573.54000000", + "9578.08000000", + "1586.56460000", + 1591408799999, + "15227040.19739193", + 18852, + "803.91244500", + "7715759.01116987", + "0" + ], + [ + 1591408800000, + "9578.64000000", + "9609.52000000", + "9551.00000000", + "9600.86000000", + "1253.79281100", + 1591412399999, + "12016402.95509393", + 18046, + "630.89168300", + "6046930.43342827", + "0" + ], + [ + 1591412400000, + "9600.17000000", + "9644.34000000", + "9571.63000000", + "9636.18000000", + "1106.81290200", + 1591415999999, + "10635600.78138758", + 14273, + "559.98389600", + "5381904.72293958", + "0" + ], + [ + 1591416000000, + "9636.17000000", + "9637.04000000", + "9603.86000000", + "9608.15000000", + "1024.61566000", + 1591419599999, + "9858726.66660989", + 13279, + "525.21560100", + "5053860.89146080", + "0" + ], + [ + 1591419600000, + "9608.37000000", + "9632.64000000", + "9580.00000000", + "9619.02000000", + "941.32506200", + 1591423199999, + "9046784.34661757", + 13840, + "470.49735700", + "4521425.97841108", + "0" + ], + [ + 1591423200000, + "9619.43000000", + "9634.16000000", + "9600.00000000", + "9610.00000000", + "874.50040700", + 1591426799999, + "8409848.24329965", + 13070, + "369.69791400", + "3555718.38218160", + "0" + ], + [ + 1591426800000, + "9610.00000000", + "9640.00000000", + "9599.01000000", + "9609.84000000", + "1079.46498400", + 1591430399999, + "10383019.71854946", + 16781, + "499.87698900", + "4807832.45300370", + "0" + ], + [ + 1591430400000, + "9609.85000000", + "9618.05000000", + "9580.00000000", + "9605.10000000", + "1443.19514000", + 1591433999999, + "13849788.64736135", + 16304, + "653.05137300", + "6267088.56254647", + "0" + ], + [ + 1591434000000, + "9604.59000000", + "9699.00000000", + "9604.59000000", + "9674.12000000", + "2625.18342900", + 1591437599999, + "25373702.95705836", + 28005, + "1527.91134100", + "14765474.56756651", + "0" + ], + [ + 1591437600000, + "9674.18000000", + "9689.78000000", + "9662.16000000", + "9673.04000000", + "983.11223800", + 1591441199999, + "9512086.61434672", + 16213, + "420.48976700", + "4068323.95295120", + "0" + ], + [ + 1591441200000, + "9674.83000000", + "9699.00000000", + "9665.06000000", + "9693.85000000", + "1008.06857300", + 1591444799999, + "9757871.27904841", + 15153, + "439.73451700", + "4257135.22615285", + "0" + ], + [ + 1591444800000, + "9693.85000000", + "9735.00000000", + "9633.00000000", + "9648.06000000", + "2677.53817600", + 1591448399999, + "25936818.39938776", + 31959, + "1312.94069600", + "12723629.52645945", + "0" + ], + [ + 1591448400000, + "9647.80000000", + "9671.91000000", + "9637.59000000", + "9653.41000000", + "1125.33568500", + 1591451999999, + "10866782.99018891", + 15553, + "650.29458300", + "6279452.86160928", + "0" + ], + [ + 1591452000000, + "9653.41000000", + "9680.31000000", + "9640.03000000", + "9650.19000000", + "983.77508600", + 1591455599999, + "9500086.44831107", + 14813, + "439.25133700", + "4242285.81936846", + "0" + ], + [ + 1591455600000, + "9650.59000000", + "9666.59000000", + "9625.33000000", + "9651.67000000", + "1064.14377100", + 1591459199999, + "10268345.39006465", + 17725, + "437.72252800", + "4223836.39948690", + "0" + ], + [ + 1591459200000, + "9651.59000000", + "9664.96000000", + "9583.93000000", + "9616.62000000", + "1610.54984900", + 1591462799999, + "15507375.78166625", + 22535, + "674.10153500", + "6492550.64348760", + "0" + ], + [ + 1591462800000, + "9616.14000000", + "9621.76000000", + "9585.99000000", + "9614.66000000", + "1139.70648200", + 1591466399999, + "10947204.37169273", + 17328, + "555.45309700", + "5335646.67623379", + "0" + ], + [ + 1591466400000, + "9614.95000000", + "9635.00000000", + "9606.00000000", + "9628.86000000", + "639.03773300", + 1591469999999, + "6149020.07553346", + 12175, + "332.37717100", + "3198275.75645806", + "0" + ], + [ + 1591470000000, + "9628.86000000", + "9677.00000000", + "9612.48000000", + "9657.39000000", + "1011.72645300", + 1591473599999, + "9755673.05664466", + 14761, + "502.52517900", + "4845859.10148217", + "0" + ], + [ + 1591473600000, + "9658.15000000", + "9720.00000000", + "9646.02000000", + "9700.52000000", + "1295.80747600", + 1591477199999, + "12543765.93876890", + 18186, + "682.28275200", + "6607047.47081619", + "0" + ], + [ + 1591477200000, + "9701.00000000", + "9729.74000000", + "9676.62000000", + "9693.30000000", + "1294.57220500", + 1591480799999, + "12557160.67741698", + 16439, + "820.32263700", + "7957782.68052867", + "0" + ], + [ + 1591480800000, + "9693.82000000", + "9707.80000000", + "9633.70000000", + "9644.63000000", + "1023.19429200", + 1591484399999, + "9886093.16849914", + 17414, + "452.72734300", + "4374656.05216780", + "0" + ], + [ + 1591484400000, + "9644.63000000", + "9702.76000000", + "9637.59000000", + "9666.30000000", + "1117.86011900", + 1591487999999, + "10802595.44359117", + 15305, + "531.74523800", + "5140151.97212038", + "0" + ], + [ + 1591488000000, + "9666.85000000", + "9674.48000000", + "9624.00000000", + "9673.00000000", + "800.26487300", + 1591491599999, + "7726256.81237468", + 13378, + "366.32649600", + "3536496.62566102", + "0" + ], + [ + 1591491600000, + "9673.29000000", + "9679.48000000", + "9646.17000000", + "9665.00000000", + "540.78740000", + 1591495199999, + "5227010.04375430", + 12011, + "252.09090000", + "2436761.50109650", + "0" + ], + [ + 1591495200000, + "9665.00000000", + "9701.61000000", + "9653.10000000", + "9684.23000000", + "1034.82082500", + 1591498799999, + "10026406.08533008", + 16301, + "442.86414900", + "4290843.44329385", + "0" + ], + [ + 1591498800000, + "9685.56000000", + "9700.00000000", + "9670.00000000", + "9685.69000000", + "707.57769500", + 1591502399999, + "6852110.44194439", + 11082, + "358.22675100", + "3468976.47363132", + "0" + ], + [ + 1591502400000, + "9685.79000000", + "9717.00000000", + "9676.55000000", + "9681.21000000", + "1261.82868200", + 1591505999999, + "12235840.45702322", + 16228, + "731.05204600", + "7088866.65128095", + "0" + ], + [ + 1591506000000, + "9681.17000000", + "9689.88000000", + "9650.00000000", + "9671.33000000", + "798.27870600", + 1591509599999, + "7721970.24294740", + 14355, + "383.46006800", + "3709469.68724730", + "0" + ], + [ + 1591509600000, + "9671.33000000", + "9682.00000000", + "9653.75000000", + "9665.80000000", + "885.02947000", + 1591513199999, + "8556258.12079402", + 12843, + "377.55368000", + "3650555.46760507", + "0" + ], + [ + 1591513200000, + "9665.72000000", + "9681.45000000", + "9597.00000000", + "9658.99000000", + "1770.10583000", + 1591516799999, + "17077755.63031241", + 18807, + "716.24097700", + "6913622.86903992", + "0" + ], + [ + 1591516800000, + "9658.99000000", + "9679.89000000", + "9555.00000000", + "9661.31000000", + "3194.28476900", + 1591520399999, + "30737377.53420339", + 35525, + "1353.78756500", + "13034791.16565370", + "0" + ], + [ + 1591520400000, + "9661.32000000", + "9675.00000000", + "9619.70000000", + "9629.96000000", + "1332.30149300", + 1591523999999, + "12852471.21764636", + 19181, + "728.15291100", + "7024986.72212188", + "0" + ], + [ + 1591524000000, + "9630.22000000", + "9643.10000000", + "9605.00000000", + "9626.45000000", + "1019.04645500", + 1591527599999, + "9809988.42630616", + 15261, + "544.01633300", + "5237012.90988404", + "0" + ], + [ + 1591527600000, + "9626.45000000", + "9637.16000000", + "9562.78000000", + "9575.59000000", + "1812.07441800", + 1591531199999, + "17397102.38773082", + 26212, + "809.87531500", + "7776733.22145305", + "0" + ], + [ + 1591531200000, + "9576.57000000", + "9602.90000000", + "9451.00000000", + "9512.28000000", + "5432.68956500", + 1591534799999, + "51776077.39917039", + 51487, + "2153.61702600", + "20526878.38321264", + "0" + ], + [ + 1591534800000, + "9511.78000000", + "9538.92000000", + "9431.00000000", + "9446.98000000", + "4376.55634100", + 1591538399999, + "41490846.20315702", + 44765, + "1846.01096300", + "17507502.78780484", + "0" + ], + [ + 1591538400000, + "9448.42000000", + "9500.00000000", + "9372.46000000", + "9454.43000000", + "6002.44140300", + 1591541999999, + "56668339.30957125", + 45810, + "3288.30249200", + "31032950.42617883", + "0" + ], + [ + 1591542000000, + "9454.98000000", + "9506.74000000", + "9452.66000000", + "9500.03000000", + "1737.10616600", + 1591545599999, + "16474628.87310451", + 23313, + "868.35612400", + "8236363.51031945", + "0" + ], + [ + 1591545600000, + "9500.04000000", + "9500.72000000", + "9454.98000000", + "9490.27000000", + "1612.77941500", + 1591549199999, + "15281424.43726872", + 21391, + "772.25977200", + "7317107.19517707", + "0" + ], + [ + 1591549200000, + "9490.25000000", + "9504.00000000", + "9458.00000000", + "9498.02000000", + "1231.15668300", + 1591552799999, + "11670811.50086883", + 18852, + "665.90465800", + "6312708.64279378", + "0" + ], + [ + 1591552800000, + "9498.08000000", + "9541.91000000", + "9490.49000000", + "9531.00000000", + "1795.06687200", + 1591556399999, + "17084960.59565982", + 22885, + "862.78890300", + "8211357.03078047", + "0" + ], + [ + 1591556400000, + "9531.00000000", + "9800.00000000", + "9515.85000000", + "9773.81000000", + "7281.76376800", + 1591559999999, + "70466432.92063856", + 66159, + "4624.49173700", + "44777376.03521072", + "0" + ], + [ + 1591560000000, + "9775.51000000", + "9802.00000000", + "9675.55000000", + "9730.08000000", + "6146.61844300", + 1591563599999, + "59856455.16279084", + 57550, + "3191.70191500", + "31064398.61517842", + "0" + ], + [ + 1591563600000, + "9730.04000000", + "9732.28000000", + "9692.00000000", + "9706.84000000", + "1507.04405700", + 1591567199999, + "14632536.55436439", + 21890, + "664.09732200", + "6447219.24573557", + "0" + ], + [ + 1591567200000, + "9706.84000000", + "9777.36000000", + "9706.84000000", + "9755.56000000", + "3513.55401000", + 1591570799999, + "34241775.56017343", + 30323, + "1457.93283100", + "14207890.55119982", + "0" + ], + [ + 1591570800000, + "9755.56000000", + "9785.19000000", + "9725.00000000", + "9746.99000000", + "2159.67104600", + 1591574399999, + "21054767.87440981", + 22157, + "967.48419500", + "9431987.02978731", + "0" + ], + [ + 1591574400000, + "9746.99000000", + "9779.99000000", + "9732.37000000", + "9761.17000000", + "2039.10370200", + 1591577999999, + "19891025.88235221", + 21933, + "1084.67799900", + "10579681.81744251", + "0" + ], + [ + 1591578000000, + "9761.17000000", + "9778.00000000", + "9734.29000000", + "9743.32000000", + "1747.03875600", + 1591581599999, + "17040090.82942276", + 17256, + "831.55245300", + "8111956.56780989", + "0" + ], + [ + 1591581600000, + "9742.60000000", + "9753.90000000", + "9698.06000000", + "9718.70000000", + "1624.61931900", + 1591585199999, + "15807885.28942710", + 19218, + "662.01425500", + "6441030.46713572", + "0" + ], + [ + 1591585200000, + "9719.00000000", + "9730.48000000", + "9699.28000000", + "9725.83000000", + "1347.38640900", + 1591588799999, + "13094016.40442613", + 12326, + "583.57479900", + "5669699.42056424", + "0" + ], + [ + 1591588800000, + "9725.48000000", + "9753.57000000", + "9723.70000000", + "9732.24000000", + "1152.03058900", + 1591592399999, + "11223654.63470366", + 14893, + "576.87325700", + "5620419.15438234", + "0" + ], + [ + 1591592400000, + "9732.15000000", + "9760.00000000", + "9720.00000000", + "9751.48000000", + "1072.35549100", + 1591595999999, + "10443771.31465960", + 14238, + "456.15374900", + "4442914.94296957", + "0" + ], + [ + 1591596000000, + "9751.48000000", + "9756.00000000", + "9714.78000000", + "9732.22000000", + "1146.88152300", + 1591599599999, + "11162637.08354222", + 16734, + "545.36588200", + "5308686.29972612", + "0" + ], + [ + 1591599600000, + "9731.89000000", + "9743.49000000", + "9715.00000000", + "9727.51000000", + "1079.86889100", + 1591603199999, + "10505431.11621455", + 13638, + "530.38846900", + "5160408.19374405", + "0" + ], + [ + 1591603200000, + "9727.51000000", + "9738.57000000", + "9633.00000000", + "9689.99000000", + "2788.23673500", + 1591606799999, + "26992615.92536400", + 29620, + "1179.70311400", + "11417060.91141208", + "0" + ], + [ + 1591606800000, + "9689.99000000", + "9800.00000000", + "9685.03000000", + "9745.85000000", + "5167.33667500", + 1591610399999, + "50378836.42012717", + 44167, + "2597.08273500", + "25321393.98905875", + "0" + ], + [ + 1591610400000, + "9745.86000000", + "9754.58000000", + "9727.04000000", + "9737.22000000", + "1344.01614400", + 1591613999999, + "13091834.36941360", + 18778, + "582.38668000", + "5672975.34239268", + "0" + ], + [ + 1591614000000, + "9737.22000000", + "9744.63000000", + "9719.78000000", + "9742.69000000", + "1453.53285700", + 1591617599999, + "14148397.06717468", + 17673, + "821.24535400", + "7994350.24536849", + "0" + ], + [ + 1591617600000, + "9742.68000000", + "9751.78000000", + "9712.85000000", + "9719.50000000", + "1837.17589300", + 1591621199999, + "17892406.03120665", + 19149, + "979.53076800", + "9540173.89954259", + "0" + ], + [ + 1591621200000, + "9719.83000000", + "9733.26000000", + "9669.00000000", + "9692.02000000", + "2324.88166100", + 1591624799999, + "22565574.27678199", + 26810, + "1042.79031100", + "10122598.85562647", + "0" + ], + [ + 1591624800000, + "9692.01000000", + "9706.96000000", + "9651.00000000", + "9671.00000000", + "1698.33862600", + 1591628399999, + "16441822.67331686", + 24452, + "722.84394100", + "6998350.51285204", + "0" + ], + [ + 1591628400000, + "9671.00000000", + "9707.03000000", + "9662.92000000", + "9705.51000000", + "1438.59218700", + 1591631999999, + "13934243.60050326", + 20951, + "768.89918100", + "7447858.56338642", + "0" + ], + [ + 1591632000000, + "9706.30000000", + "9728.13000000", + "9661.00000000", + "9714.99000000", + "1824.14842600", + 1591635599999, + "17670415.02946536", + 25504, + "931.59006900", + "9025123.73235214", + "0" + ], + [ + 1591635600000, + "9715.00000000", + "9746.00000000", + "9700.67000000", + "9720.81000000", + "1633.57960000", + 1591639199999, + "15880221.34591652", + 21553, + "828.99103900", + "8059555.76288824", + "0" + ], + [ + 1591639200000, + "9721.56000000", + "9733.73000000", + "9693.73000000", + "9702.67000000", + "1156.94870100", + 1591642799999, + "11240686.31661865", + 15753, + "575.85460000", + "5594865.16036227", + "0" + ], + [ + 1591642800000, + "9702.66000000", + "9715.48000000", + "9680.79000000", + "9694.65000000", + "999.13345200", + 1591646399999, + "9691147.91444075", + 15090, + "460.18912700", + "4463823.12024797", + "0" + ], + [ + 1591646400000, + "9694.64000000", + "9722.19000000", + "9690.00000000", + "9701.69000000", + "962.12062200", + 1591649999999, + "9338069.42403315", + 14820, + "379.84011500", + "3686443.62559705", + "0" + ], + [ + 1591650000000, + "9701.69000000", + "9717.00000000", + "9676.58000000", + "9709.78000000", + "823.36387800", + 1591653599999, + "7984793.79917474", + 16129, + "408.55111500", + "3961995.09119210", + "0" + ], + [ + 1591653600000, + "9710.99000000", + "9728.67000000", + "9686.00000000", + "9695.00000000", + "950.01317100", + 1591657199999, + "9225867.26855504", + 13068, + "480.26086400", + "4664432.01214707", + "0" + ], + [ + 1591657200000, + "9694.89000000", + "9800.00000000", + "9691.96000000", + "9782.01000000", + "3053.96081700", + 1591660799999, + "29813951.80449659", + 31386, + "1713.67924800", + "16732153.35728892", + "0" + ], + [ + 1591660800000, + "9782.00000000", + "9877.00000000", + "9570.00000000", + "9703.05000000", + "8895.76096000", + 1591664399999, + "86642121.33593393", + 82146, + "4561.21132900", + "44508131.16305506", + "0" + ], + [ + 1591664400000, + "9703.23000000", + "9717.91000000", + "9684.00000000", + "9698.48000000", + "1028.32372100", + 1591667999999, + "9975951.70612061", + 15712, + "491.61869100", + "4769791.12557737", + "0" + ], + [ + 1591668000000, + "9697.26000000", + "9712.85000000", + "9685.01000000", + "9696.53000000", + "1335.86035800", + 1591671599999, + "12955164.67378498", + 14973, + "561.87521400", + "5449494.33106894", + "0" + ], + [ + 1591671600000, + "9696.53000000", + "9698.48000000", + "9659.78000000", + "9679.22000000", + "1771.11596700", + 1591675199999, + "17141286.29998046", + 18607, + "831.45129000", + "8047717.90639588", + "0" + ], + [ + 1591675200000, + "9678.95000000", + "9688.00000000", + "9653.75000000", + "9672.93000000", + "1415.93639300", + 1591678799999, + "13694156.66855094", + 19867, + "587.29136000", + "5680469.55610209", + "0" + ], + [ + 1591678800000, + "9673.82000000", + "9699.00000000", + "9663.00000000", + "9696.82000000", + "1186.17673400", + 1591682399999, + "11484998.39428913", + 16993, + "544.26834700", + "5269376.51931131", + "0" + ], + [ + 1591682400000, + "9696.82000000", + "9697.18000000", + "9684.25000000", + "9693.43000000", + "813.52731200", + 1591685999999, + "7883410.33597821", + 12924, + "267.88630500", + "2595904.53443080", + "0" + ], + [ + 1591686000000, + "9693.04000000", + "9706.87000000", + "9668.08000000", + "9681.75000000", + "1169.42850100", + 1591689599999, + "11331249.22833926", + 15477, + "448.84363800", + "4349011.16571617", + "0" + ], + [ + 1591689600000, + "9681.81000000", + "9690.62000000", + "9665.64000000", + "9683.46000000", + "1380.37675100", + 1591693199999, + "13360455.44147894", + 16554, + "579.29167500", + "5606990.15634271", + "0" + ], + [ + 1591693200000, + "9683.47000000", + "9685.00000000", + "9642.10000000", + "9669.70000000", + "1463.92398800", + 1591696799999, + "14150743.66425575", + 20008, + "578.84950300", + "5595023.67033609", + "0" + ], + [ + 1591696800000, + "9669.70000000", + "9679.00000000", + "9624.53000000", + "9676.00000000", + "1891.55025700", + 1591700399999, + "18274985.85851979", + 22711, + "796.11353700", + "7693374.84870043", + "0" + ], + [ + 1591700400000, + "9675.99000000", + "9728.00000000", + "9663.57000000", + "9721.24000000", + "1943.34339000", + 1591703999999, + "18828969.68277300", + 24142, + "1011.21096300", + "9799488.98693869", + "0" + ], + [ + 1591704000000, + "9721.23000000", + "9748.95000000", + "9708.98000000", + "9720.57000000", + "2313.43489200", + 1591707599999, + "22503325.86659439", + 27875, + "1200.86848600", + "11681338.82718788", + "0" + ], + [ + 1591707600000, + "9720.57000000", + "9734.00000000", + "9672.00000000", + "9706.58000000", + "1993.33750600", + 1591711199999, + "19345635.65404764", + 25947, + "970.02786100", + "9412636.19678982", + "0" + ], + [ + 1591711200000, + "9706.28000000", + "9734.00000000", + "9682.00000000", + "9713.76000000", + "1840.78607200", + 1591714799999, + "17865775.54326143", + 20804, + "855.42561500", + "8302613.30689845", + "0" + ], + [ + 1591714800000, + "9713.75000000", + "9728.00000000", + "9701.42000000", + "9719.89000000", + "1495.87259600", + 1591718399999, + "14532287.07600940", + 19407, + "730.40237300", + "7096337.62145878", + "0" + ], + [ + 1591718400000, + "9719.89000000", + "9727.85000000", + "9688.13000000", + "9704.43000000", + "1587.19129200", + 1591721999999, + "15408442.83620048", + 19603, + "657.41249900", + "6382800.02746126", + "0" + ], + [ + 1591722000000, + "9704.43000000", + "9718.00000000", + "9691.08000000", + "9703.39000000", + "1118.87772900", + 1591725599999, + "10858888.99970080", + 14691, + "519.81907200", + "5045065.40378956", + "0" + ], + [ + 1591725600000, + "9703.39000000", + "9713.08000000", + "9689.91000000", + "9703.09000000", + "1189.74891000", + 1591729199999, + "11545190.71579233", + 14537, + "524.41605800", + "5089222.72016788", + "0" + ], + [ + 1591729200000, + "9703.77000000", + "9744.51000000", + "9681.94000000", + "9731.15000000", + "1633.40066900", + 1591732799999, + "15859640.67262998", + 19676, + "760.56038900", + "7385630.93700219", + "0" + ], + [ + 1591732800000, + "9731.15000000", + "9765.00000000", + "9713.80000000", + "9742.31000000", + "1615.25710500", + 1591736399999, + "15728498.49070541", + 20884, + "768.82586300", + "7487931.58507846", + "0" + ], + [ + 1591736400000, + "9742.30000000", + "9825.00000000", + "9740.79000000", + "9809.99000000", + "2803.28389300", + 1591739999999, + "27428573.90121532", + 37799, + "1689.70558500", + "16534939.15195519", + "0" + ], + [ + 1591740000000, + "9810.00000000", + "9829.00000000", + "9694.00000000", + "9771.82000000", + "2626.56555400", + 1591743599999, + "25647894.31043754", + 33254, + "1303.84948100", + "12732813.66005402", + "0" + ], + [ + 1591743600000, + "9771.98000000", + "9800.00000000", + "9736.22000000", + "9772.43000000", + "1510.92073900", + 1591747199999, + "14761248.48209862", + 17272, + "659.96581600", + "6449305.27600906", + "0" + ], + [ + 1591747200000, + "9772.44000000", + "9799.03000000", + "9753.21000000", + "9774.97000000", + "1643.81845000", + 1591750799999, + "16065862.22982396", + 20734, + "657.27923200", + "6423893.13806355", + "0" + ], + [ + 1591750800000, + "9774.97000000", + "9810.00000000", + "9774.97000000", + "9788.51000000", + "1386.03371900", + 1591754399999, + "13571987.29769858", + 18905, + "545.61389900", + "5342652.36465577", + "0" + ], + [ + 1591754400000, + "9788.51000000", + "9790.82000000", + "9761.00000000", + "9774.82000000", + "1044.90262800", + 1591757999999, + "10212782.31147060", + 14893, + "444.54014800", + "4344102.94587534", + "0" + ], + [ + 1591758000000, + "9774.82000000", + "9774.83000000", + "9735.59000000", + "9754.50000000", + "1528.04472800", + 1591761599999, + "14908663.98725288", + 17563, + "651.24822300", + "6353700.16030484", + "0" + ], + [ + 1591761600000, + "9754.50000000", + "9758.03000000", + "9731.82000000", + "9750.84000000", + "1021.44320400", + 1591765199999, + "9956691.07083056", + 14915, + "569.19119900", + "5548727.14409609", + "0" + ], + [ + 1591765200000, + "9750.85000000", + "9780.00000000", + "9748.32000000", + "9771.51000000", + "1257.90296100", + 1591768799999, + "12283902.65452022", + 18460, + "591.55040200", + "5776761.13623177", + "0" + ], + [ + 1591768800000, + "9771.52000000", + "9780.00000000", + "9759.13000000", + "9779.93000000", + "946.59756100", + 1591772399999, + "9246802.19646157", + 16495, + "436.81253900", + "4267082.32591453", + "0" + ], + [ + 1591772400000, + "9779.93000000", + "9790.00000000", + "9720.00000000", + "9747.89000000", + "1763.59048100", + 1591775999999, + "17200772.34179219", + 24870, + "805.28317300", + "7855136.04341159", + "0" + ], + [ + 1591776000000, + "9747.88000000", + "9765.79000000", + "9732.00000000", + "9739.00000000", + "1171.30407000", + 1591779599999, + "11415245.28174090", + 18977, + "552.50467000", + "5385025.13111271", + "0" + ], + [ + 1591779600000, + "9739.00000000", + "9739.99000000", + "9706.04000000", + "9724.25000000", + "1771.37210500", + 1591783199999, + "17226498.42365177", + 24636, + "749.84215000", + "7291783.69044552", + "0" + ], + [ + 1591783200000, + "9724.25000000", + "9747.00000000", + "9716.55000000", + "9742.45000000", + "1154.36140500", + 1591786799999, + "11237576.39299895", + 16472, + "532.28137700", + "5181922.59839721", + "0" + ], + [ + 1591786800000, + "9743.06000000", + "9747.48000000", + "9725.04000000", + "9729.60000000", + "1000.05161700", + 1591790399999, + "9738446.58197070", + 16221, + "474.01647700", + "4616192.95606112", + "0" + ], + [ + 1591790400000, + "9728.41000000", + "9774.20000000", + "9720.00000000", + "9763.98000000", + "1505.40999200", + 1591793999999, + "14680206.71615112", + 20944, + "736.44360300", + "7182415.11017819", + "0" + ], + [ + 1591794000000, + "9763.85000000", + "9779.00000000", + "9734.98000000", + "9750.00000000", + "1248.33102500", + 1591797599999, + "12183707.52933699", + 19011, + "554.66764700", + "5413729.00127714", + "0" + ], + [ + 1591797600000, + "9750.00000000", + "9760.00000000", + "9731.18000000", + "9750.25000000", + "1276.80034800", + 1591801199999, + "12445069.27931176", + 20759, + "636.53777300", + "6204425.36847333", + "0" + ], + [ + 1591801200000, + "9750.24000000", + "9763.96000000", + "9735.82000000", + "9758.33000000", + "1167.23434700", + 1591804799999, + "11379434.71008675", + 21660, + "604.76813800", + "5896136.70842515", + "0" + ], + [ + 1591804800000, + "9758.32000000", + "9776.00000000", + "9750.00000000", + "9763.36000000", + "1455.23747900", + 1591808399999, + "14209612.81539867", + 20733, + "720.92179000", + "7039259.73359827", + "0" + ], + [ + 1591808400000, + "9763.37000000", + "9779.00000000", + "9751.78000000", + "9773.58000000", + "975.02099500", + 1591811999999, + "9518757.20995165", + 13522, + "488.10457000", + "4765309.07328685", + "0" + ], + [ + 1591812000000, + "9773.93000000", + "9992.72000000", + "9704.18000000", + "9823.58000000", + "12331.05803500", + 1591815599999, + "121636208.13758620", + 98731, + "6929.92105900", + "68370254.20999543", + "0" + ], + [ + 1591815600000, + "9823.63000000", + "9925.00000000", + "9800.00000000", + "9852.18000000", + "4362.19515200", + 1591819199999, + "42959683.41429313", + 42642, + "2263.39397000", + "22293324.05095595", + "0" + ], + [ + 1591819200000, + "9852.17000000", + "9900.00000000", + "9852.17000000", + "9862.06000000", + "1927.96496800", + 1591822799999, + "19039689.04184916", + 21349, + "804.56614400", + "7944591.82865068", + "0" + ], + [ + 1591822800000, + "9863.08000000", + "9869.96000000", + "9821.95000000", + "9847.39000000", + "1157.08036000", + 1591826399999, + "11398363.96591263", + 17919, + "542.11914400", + "5339583.99526836", + "0" + ], + [ + 1591826400000, + "9847.11000000", + "9913.00000000", + "9845.24000000", + "9891.28000000", + "2652.28955400", + 1591829999999, + "26204642.43951553", + 23458, + "1221.25397000", + "12066524.74473240", + "0" + ], + [ + 1591830000000, + "9891.15000000", + "9902.50000000", + "9853.68000000", + "9885.00000000", + "1382.71779800", + 1591833599999, + "13663699.32159288", + 17040, + "615.29973500", + "6080102.15974265", + "0" + ], + [ + 1591833600000, + "9885.22000000", + "9901.85000000", + "9870.02000000", + "9890.34000000", + "1776.78531400", + 1591837199999, + "17568633.49566465", + 21167, + "828.80451800", + "8195298.22559035", + "0" + ], + [ + 1591837200000, + "9890.34000000", + "9964.00000000", + "9876.26000000", + "9929.98000000", + "2785.71655400", + 1591840799999, + "27646714.30173572", + 28124, + "1378.90496200", + "13688181.26897992", + "0" + ], + [ + 1591840800000, + "9929.97000000", + "9950.00000000", + "9876.69000000", + "9916.99000000", + "2736.47624100", + 1591844399999, + "27145794.39575568", + 25991, + "1276.70797100", + "12664619.11929837", + "0" + ], + [ + 1591844400000, + "9916.99000000", + "9933.20000000", + "9860.00000000", + "9889.17000000", + "2332.77123600", + 1591847999999, + "23090394.99338032", + 26236, + "897.16332000", + "8880499.08529187", + "0" + ], + [ + 1591848000000, + "9889.16000000", + "9906.00000000", + "9865.52000000", + "9889.03000000", + "927.27135800", + 1591851599999, + "9167241.32416478", + 16224, + "472.40775300", + "4670504.54192606", + "0" + ], + [ + 1591851600000, + "9888.38000000", + "9889.11000000", + "9862.76000000", + "9887.16000000", + "1080.84555200", + 1591855199999, + "10675193.08174325", + 15084, + "509.34300800", + "5030676.51393500", + "0" + ], + [ + 1591855200000, + "9887.15000000", + "9889.89000000", + "9758.00000000", + "9831.31000000", + "5266.24298900", + 1591858799999, + "51689417.93738241", + 45189, + "2251.32721300", + "22098121.48342677", + "0" + ], + [ + 1591858800000, + "9831.62000000", + "9834.11000000", + "9793.39000000", + "9796.47000000", + "1955.35242800", + 1591862399999, + "19185896.06471615", + 22757, + "836.99643300", + "8213451.02130419", + "0" + ], + [ + 1591862400000, + "9796.29000000", + "9821.91000000", + "9784.46000000", + "9803.12000000", + "1612.16961400", + 1591865999999, + "15809005.01162659", + 18653, + "779.55044900", + "7644590.95286618", + "0" + ], + [ + 1591866000000, + "9803.12000000", + "9817.46000000", + "9767.00000000", + "9797.13000000", + "2008.11480300", + 1591869599999, + "19669906.17235801", + 26171, + "1004.22380600", + "9837185.78496798", + "0" + ], + [ + 1591869600000, + "9797.13000000", + "9804.97000000", + "9760.00000000", + "9798.08000000", + "2081.68271300", + 1591873199999, + "20380111.01660806", + 28326, + "1078.22332300", + "10557943.27874272", + "0" + ], + [ + 1591873200000, + "9798.07000000", + "9803.55000000", + "9755.52000000", + "9788.57000000", + "2108.48461500", + 1591876799999, + "20619199.77319383", + 27719, + "994.72484800", + "9728662.73839697", + "0" + ], + [ + 1591876800000, + "9787.58000000", + "9796.29000000", + "9675.00000000", + "9721.37000000", + "3702.02574600", + 1591880399999, + "36075076.15189109", + 41291, + "1408.75544700", + "13737225.61419806", + "0" + ] + ], + "queryString": "endTime=1591880400000\u0026interval=1h\u0026limit=1000\u0026startTime=1588280400000\u0026symbol=BTCUSDT", + "bodyParams": "", + "headers": {} + }, + { + "data": [ + [ + 1591880400000, + "9721.37000000", + "9742.83000000", + "9587.14000000", + "9635.54000000", + "8889.03670100", + 1591883999999, + "85878391.55991540", + 81486, + "3808.38702400", + "36813672.22713861", + "0" + ], + [ + 1591884000000, + "9635.05000000", + "9675.00000000", + "9601.11000000", + "9617.38000000", + "4191.04186800", + 1591887599999, + "40387713.18425843", + 41676, + "1890.90752000", + "18223864.89793586", + "0" + ], + [ + 1591887600000, + "9617.59000000", + "9617.87000000", + "9502.00000000", + "9521.11000000", + "6632.57213500", + 1591891199999, + "63354676.25890192", + 64347, + "2638.05818000", + "25201025.70070968", + "0" + ], + [ + 1591891200000, + "9521.54000000", + "9569.97000000", + "9117.00000000", + "9117.01000000", + "14091.72016200", + 1591894799999, + "132417670.96811141", + 115135, + "4697.83032900", + "44257352.39306225", + "0" + ], + [ + 1591894800000, + "9117.01000000", + "9399.48000000", + "9113.00000000", + "9382.57000000", + "12934.87443000", + 1591898399999, + "120193952.84780345", + 107848, + "6408.60020100", + "59534373.60426224", + "0" + ], + [ + 1591898400000, + "9381.33000000", + "9391.93000000", + "9283.57000000", + "9315.16000000", + "4409.04631900", + 1591901999999, + "41173610.65529383", + 55232, + "1865.64599000", + "17423198.68015331", + "0" + ], + [ + 1591902000000, + "9315.26000000", + "9334.51000000", + "9261.00000000", + "9280.93000000", + "2722.76870000", + 1591905599999, + "25308032.22856295", + 31414, + "1330.44288600", + "12365595.48290100", + "0" + ], + [ + 1591905600000, + "9280.93000000", + "9351.18000000", + "9230.00000000", + "9349.99000000", + "4226.77401300", + 1591909199999, + "39214969.66632083", + 42062, + "1966.49726600", + "18242696.62726930", + "0" + ], + [ + 1591909200000, + "9349.99000000", + "9375.01000000", + "9318.21000000", + "9354.84000000", + "1761.02091100", + 1591912799999, + "16458501.84526653", + 31702, + "801.94710800", + "7494881.30922131", + "0" + ], + [ + 1591912800000, + "9354.74000000", + "9357.94000000", + "9291.00000000", + "9325.99000000", + "1598.29898700", + 1591916399999, + "14913896.31479064", + 22229, + "717.51334400", + "6695630.49851629", + "0" + ], + [ + 1591916400000, + "9324.75000000", + "9334.09000000", + "9255.10000000", + "9280.40000000", + "2587.89134100", + 1591919999999, + "24051649.29593900", + 30439, + "1129.10185000", + "10490298.60787159", + "0" + ], + [ + 1591920000000, + "9278.88000000", + "9335.00000000", + "9232.51000000", + "9317.34000000", + "2798.50627000", + 1591923599999, + "26006892.28779767", + 37302, + "1458.01031700", + "13552465.50126686", + "0" + ], + [ + 1591923600000, + "9317.34000000", + "9357.99000000", + "9300.10000000", + "9339.49000000", + "1686.39391900", + 1591927199999, + "15732852.53618782", + 25388, + "810.73180500", + "7565157.93061347", + "0" + ], + [ + 1591927200000, + "9339.94000000", + "9360.00000000", + "9331.00000000", + "9358.48000000", + "1300.81186800", + 1591930799999, + "12154619.83059632", + 18360, + "549.69464200", + "5136480.11937660", + "0" + ], + [ + 1591930800000, + "9358.48000000", + "9396.00000000", + "9340.00000000", + "9363.44000000", + "2625.24002600", + 1591934399999, + "24601880.12490256", + 26342, + "1456.42175900", + "13652010.90293344", + "0" + ], + [ + 1591934400000, + "9364.15000000", + "9390.00000000", + "9353.92000000", + "9361.98000000", + "1371.77248000", + 1591937999999, + "12857496.73702684", + 19256, + "627.64457400", + "5883240.69773823", + "0" + ], + [ + 1591938000000, + "9361.49000000", + "9395.78000000", + "9345.40000000", + "9383.60000000", + "1915.13956900", + 1591941599999, + "17951417.46500867", + 20953, + "823.97147200", + "7725286.37656283", + "0" + ], + [ + 1591941600000, + "9383.59000000", + "9398.90000000", + "9365.93000000", + "9371.83000000", + "1911.78710800", + 1591945199999, + "17934202.40114510", + 19566, + "737.78837600", + "6921706.48200974", + "0" + ], + [ + 1591945200000, + "9371.83000000", + "9463.00000000", + "9371.81000000", + "9439.00000000", + "3293.72745100", + 1591948799999, + "31052512.61947733", + 33562, + "1913.92084000", + "18045154.53457701", + "0" + ], + [ + 1591948800000, + "9439.48000000", + "9487.91000000", + "9433.73000000", + "9474.72000000", + "3520.93428600", + 1591952399999, + "33322010.37386935", + 36314, + "1606.61256400", + "15205465.87181704", + "0" + ], + [ + 1591952400000, + "9474.16000000", + "9482.59000000", + "9447.85000000", + "9455.06000000", + "1459.20091700", + 1591955999999, + "13805513.87526828", + 22971, + "657.81007600", + "6223717.94423165", + "0" + ], + [ + 1591956000000, + "9454.70000000", + "9485.00000000", + "9451.98000000", + "9464.93000000", + "1497.18585100", + 1591959599999, + "14177605.76992061", + 22170, + "678.88588100", + "6428853.50365728", + "0" + ], + [ + 1591959600000, + "9464.92000000", + "9516.95000000", + "9464.75000000", + "9495.60000000", + "2524.92314600", + 1591963199999, + "23979115.53434412", + 27852, + "1334.11445200", + "12670849.67225761", + "0" + ], + [ + 1591963200000, + "9495.60000000", + "9504.65000000", + "9412.02000000", + "9459.66000000", + "2882.67205100", + 1591966799999, + "27267356.70638419", + 29186, + "1505.85615100", + "14242711.13262296", + "0" + ], + [ + 1591966800000, + "9459.66000000", + "9547.00000000", + "9442.55000000", + "9542.19000000", + "2283.90215400", + 1591970399999, + "21678108.14401262", + 21497, + "1225.83350400", + "11637105.08891620", + "0" + ], + [ + 1591970400000, + "9543.66000000", + "9557.12000000", + "9415.00000000", + "9415.00000000", + "3341.82940600", + 1591973999999, + "31727359.74683161", + 26323, + "1463.19535700", + "13899531.60809699", + "0" + ], + [ + 1591974000000, + "9415.01000000", + "9445.45000000", + "9360.81000000", + "9417.81000000", + "3470.52567700", + 1591977599999, + "32649985.84085297", + 27050, + "1691.06329700", + "15910496.06673646", + "0" + ], + [ + 1591977600000, + "9417.98000000", + "9457.99000000", + "9396.61000000", + "9420.77000000", + "1704.16213200", + 1591981199999, + "16058665.57842561", + 16639, + "798.88793300", + "7528355.36494518", + "0" + ], + [ + 1591981200000, + "9420.78000000", + "9422.07000000", + "9301.00000000", + "9335.07000000", + "3155.06690800", + 1591984799999, + "29517546.74682343", + 25146, + "1196.40977400", + "11192955.88464829", + "0" + ], + [ + 1591984800000, + "9335.22000000", + "9416.00000000", + "9324.23000000", + "9397.99000000", + "1501.92352800", + 1591988399999, + "14087195.03998010", + 16743, + "806.11473600", + "7562034.48026928", + "0" + ], + [ + 1591988400000, + "9397.98000000", + "9450.00000000", + "9350.00000000", + "9431.21000000", + "2106.44187200", + 1591991999999, + "19833458.42852786", + 21550, + "1002.06970400", + "9437582.76934918", + "0" + ], + [ + 1591992000000, + "9431.11000000", + "9485.71000000", + "9409.85000000", + "9466.32000000", + "1236.72221200", + 1591995599999, + "11680577.78964593", + 16086, + "698.82544500", + "6599236.11448752", + "0" + ], + [ + 1591995600000, + "9466.32000000", + "9475.89000000", + "9426.76000000", + "9439.43000000", + "695.14125900", + 1591999199999, + "6571803.68547401", + 12456, + "366.84274500", + "3468394.75996761", + "0" + ], + [ + 1591999200000, + "9439.27000000", + "9488.00000000", + "9438.01000000", + "9477.95000000", + "932.18787700", + 1592002799999, + "8818551.19639369", + 14988, + "514.46979500", + "4867032.54765823", + "0" + ], + [ + 1592002800000, + "9478.16000000", + "9488.15000000", + "9441.24000000", + "9465.13000000", + "902.86896500", + 1592006399999, + "8541165.91677863", + 15503, + "419.64117100", + "3970145.51639250", + "0" + ], + [ + 1592006400000, + "9464.96000000", + "9477.18000000", + "9431.05000000", + "9446.76000000", + "1347.10722500", + 1592009999999, + "12729849.50707814", + 21789, + "560.83735400", + "5299574.24929103", + "0" + ], + [ + 1592010000000, + "9446.67000000", + "9449.89000000", + "9423.00000000", + "9442.45000000", + "741.00372600", + 1592013599999, + "6992784.76074772", + 14154, + "351.08725200", + "3313187.98038805", + "0" + ], + [ + 1592013600000, + "9442.34000000", + "9442.34000000", + "9409.87000000", + "9426.57000000", + "715.46261400", + 1592017199999, + "6744837.28373017", + 12943, + "336.82569100", + "3175584.72781582", + "0" + ], + [ + 1592017200000, + "9426.58000000", + "9431.90000000", + "9398.49000000", + "9408.54000000", + "1033.33733300", + 1592020799999, + "9732715.01020285", + 13923, + "561.41894700", + "5288191.92923211", + "0" + ], + [ + 1592020800000, + "9408.54000000", + "9410.00000000", + "9362.08000000", + "9407.60000000", + "1768.05180200", + 1592024399999, + "16600028.89700280", + 21481, + "820.62939000", + "7705819.71680814", + "0" + ], + [ + 1592024400000, + "9407.60000000", + "9416.00000000", + "9380.04000000", + "9413.63000000", + "785.73585100", + 1592027999999, + "7383714.63813560", + 13030, + "425.28825300", + "3996669.23938549", + "0" + ], + [ + 1592028000000, + "9413.63000000", + "9435.61000000", + "9395.00000000", + "9428.89000000", + "1021.08927500", + 1592031599999, + "9615615.32832698", + 15637, + "548.46809300", + "5164380.22774869", + "0" + ], + [ + 1592031600000, + "9428.89000000", + "9448.99000000", + "9418.01000000", + "9437.90000000", + "1147.39864100", + 1592035199999, + "10822833.45522761", + 14849, + "592.33903800", + "5587233.45592742", + "0" + ], + [ + 1592035200000, + "9437.69000000", + "9447.40000000", + "9418.58000000", + "9440.01000000", + "849.44714600", + 1592038799999, + "8012114.61832229", + 13391, + "426.97502200", + "4027488.03218828", + "0" + ], + [ + 1592038800000, + "9440.02000000", + "9470.00000000", + "9422.76000000", + "9443.01000000", + "1839.25128900", + 1592042399999, + "17371028.87808012", + 19934, + "916.17158600", + "8655158.19281776", + "0" + ], + [ + 1592042400000, + "9443.01000000", + "9451.44000000", + "9380.00000000", + "9417.26000000", + "1368.43522100", + 1592045999999, + "12894573.50881752", + 18677, + "545.96677900", + "5146024.79543157", + "0" + ], + [ + 1592046000000, + "9417.44000000", + "9427.68000000", + "9389.98000000", + "9405.10000000", + "1062.19151900", + 1592049599999, + "9996215.59990172", + 17346, + "504.85198900", + "4751560.62083918", + "0" + ], + [ + 1592049600000, + "9405.13000000", + "9447.00000000", + "9390.05000000", + "9420.89000000", + "1977.27699000", + 1592053199999, + "18628893.16039068", + 19549, + "968.03620500", + "9125119.69111865", + "0" + ], + [ + 1592053200000, + "9420.89000000", + "9434.84000000", + "9403.00000000", + "9429.04000000", + "1209.50738600", + 1592056799999, + "11391952.45899276", + 16116, + "577.61331600", + "5440976.47892411", + "0" + ], + [ + 1592056800000, + "9429.09000000", + "9458.48000000", + "9423.16000000", + "9448.59000000", + "1048.58268400", + 1592060399999, + "9900066.95438018", + 16224, + "623.08718900", + "5883342.23275440", + "0" + ], + [ + 1592060400000, + "9448.59000000", + "9468.00000000", + "9430.00000000", + "9437.42000000", + "1201.94235700", + 1592063999999, + "11354276.20581463", + 16450, + "591.14592200", + "5585101.18907378", + "0" + ], + [ + 1592064000000, + "9437.42000000", + "9447.14000000", + "9415.53000000", + "9431.45000000", + "884.57418000", + 1592067599999, + "8344079.18993299", + 15652, + "420.71622400", + "3969001.11302356", + "0" + ], + [ + 1592067600000, + "9431.00000000", + "9450.00000000", + "9424.70000000", + "9430.35000000", + "618.32047300", + 1592071199999, + "5835643.13238709", + 11803, + "314.00468800", + "2963686.41838062", + "0" + ], + [ + 1592071200000, + "9430.36000000", + "9453.00000000", + "9430.35000000", + "9443.50000000", + "661.29251300", + 1592074799999, + "6245849.45427884", + 12228, + "305.60357400", + "2886191.68550366", + "0" + ], + [ + 1592074800000, + "9443.50000000", + "9494.73000000", + "9386.21000000", + "9404.08000000", + "1990.32210800", + 1592078399999, + "18794234.68003480", + 23213, + "1015.60386300", + "9598358.59431324", + "0" + ], + [ + 1592078400000, + "9404.13000000", + "9428.72000000", + "9351.00000000", + "9403.14000000", + "1981.09750300", + 1592081999999, + "18605308.63348263", + 23431, + "830.70672600", + "7803443.59245351", + "0" + ], + [ + 1592082000000, + "9403.14000000", + "9428.99000000", + "9400.40000000", + "9422.44000000", + "581.08144800", + 1592085599999, + "5471102.60930126", + 10999, + "305.11467400", + "2872978.06236923", + "0" + ], + [ + 1592085600000, + "9424.05000000", + "9448.88000000", + "9410.00000000", + "9437.75000000", + "786.25477000", + 1592089199999, + "7415230.46238732", + 12863, + "406.46822600", + "3833471.98226220", + "0" + ], + [ + 1592089200000, + "9437.91000000", + "9480.46000000", + "9430.00000000", + "9473.34000000", + "1141.02079700", + 1592092799999, + "10790213.83151572", + 17081, + "582.04721300", + "5504624.10928951", + "0" + ], + [ + 1592092800000, + "9473.34000000", + "9480.99000000", + "9435.00000000", + "9455.01000000", + "887.60596000", + 1592096399999, + "8395182.88728483", + 14582, + "407.10552600", + "3849999.78963878", + "0" + ], + [ + 1592096400000, + "9455.00000000", + "9459.87000000", + "9436.55000000", + "9444.63000000", + "576.74040700", + 1592099999999, + "5447496.78667537", + 11110, + "291.95804100", + "2757458.93578571", + "0" + ], + [ + 1592100000000, + "9444.72000000", + "9461.35000000", + "9438.65000000", + "9447.01000000", + "510.32488900", + 1592103599999, + "4822363.17074671", + 10484, + "252.09768600", + "2382247.56990687", + "0" + ], + [ + 1592103600000, + "9447.00000000", + "9450.01000000", + "9425.15000000", + "9434.81000000", + "585.10608400", + 1592107199999, + "5520137.71798516", + 9375, + "290.75921400", + "2743122.63073551", + "0" + ], + [ + 1592107200000, + "9434.81000000", + "9444.46000000", + "9423.26000000", + "9429.49000000", + "529.04632100", + 1592110799999, + "4991045.34742134", + 9004, + "343.14370400", + "3237275.60703106", + "0" + ], + [ + 1592110800000, + "9429.49000000", + "9442.41000000", + "9414.13000000", + "9433.01000000", + "764.52026800", + 1592114399999, + "7209146.10513319", + 12342, + "359.05895300", + "3386342.48281411", + "0" + ], + [ + 1592114400000, + "9433.02000000", + "9439.98000000", + "9387.00000000", + "9401.69000000", + "1124.57526700", + 1592117999999, + "10587606.61162302", + 16789, + "481.25257300", + "4531694.87386957", + "0" + ], + [ + 1592118000000, + "9400.58000000", + "9421.17000000", + "9380.00000000", + "9414.63000000", + "1558.87894700", + 1592121599999, + "14660698.23396320", + 20146, + "791.80968200", + "7447368.94403015", + "0" + ], + [ + 1592121600000, + "9414.55000000", + "9436.70000000", + "9388.00000000", + "9432.14000000", + "1067.31603400", + 1592125199999, + "10055602.96063729", + 17258, + "562.27190300", + "5298046.61145109", + "0" + ], + [ + 1592125200000, + "9431.91000000", + "9434.05000000", + "9409.99000000", + "9418.70000000", + "759.89567200", + 1592128799999, + "7158294.75527852", + 13593, + "393.78673600", + "3709583.79675727", + "0" + ], + [ + 1592128800000, + "9418.70000000", + "9429.74000000", + "9413.57000000", + "9425.00000000", + "580.07448300", + 1592132399999, + "5466127.15376206", + 10240, + "328.66361000", + "3097021.33409245", + "0" + ], + [ + 1592132400000, + "9425.00000000", + "9443.46000000", + "9419.50000000", + "9426.34000000", + "713.08653800", + 1592135999999, + "6726501.22607252", + 13270, + "387.22935700", + "3652478.69067984", + "0" + ], + [ + 1592136000000, + "9426.61000000", + "9435.71000000", + "9393.75000000", + "9410.57000000", + "1164.10717700", + 1592139599999, + "10956452.66448383", + 16789, + "529.29595100", + "4982136.00119027", + "0" + ], + [ + 1592139600000, + "9410.06000000", + "9422.30000000", + "9373.00000000", + "9407.88000000", + "1794.98009100", + 1592143199999, + "16863302.55052431", + 23546, + "887.30088400", + "8336654.64279200", + "0" + ], + [ + 1592143200000, + "9406.93000000", + "9417.13000000", + "9311.02000000", + "9347.19000000", + "3141.01168900", + 1592146799999, + "29392351.65756756", + 35083, + "1607.18687800", + "15038276.13774033", + "0" + ], + [ + 1592146800000, + "9347.64000000", + "9438.71000000", + "9333.61000000", + "9419.36000000", + "2824.02529000", + 1592150399999, + "26536000.72513892", + 29708, + "1303.69538400", + "12246028.03162322", + "0" + ], + [ + 1592150400000, + "9419.36000000", + "9431.74000000", + "9386.00000000", + "9393.60000000", + "927.54043900", + 1592153999999, + "8725154.28468084", + 17169, + "410.50336800", + "3861928.87562997", + "0" + ], + [ + 1592154000000, + "9393.60000000", + "9411.83000000", + "9377.65000000", + "9396.88000000", + "866.14154200", + 1592157599999, + "8137852.42267960", + 14668, + "432.27068800", + "4061133.92975589", + "0" + ], + [ + 1592157600000, + "9396.27000000", + "9398.71000000", + "9366.66000000", + "9382.92000000", + "799.22710400", + 1592161199999, + "7497495.37483693", + 11368, + "390.76650700", + "3665697.30895273", + "0" + ], + [ + 1592161200000, + "9382.92000000", + "9404.54000000", + "9380.08000000", + "9394.04000000", + "660.20904300", + 1592164799999, + "6199541.54164893", + 9273, + "358.24463600", + "3364230.78439974", + "0" + ], + [ + 1592164800000, + "9394.05000000", + "9409.88000000", + "9380.96000000", + "9380.97000000", + "555.46461200", + 1592168399999, + "5217461.51451622", + 10049, + "279.22103900", + "2622965.55108787", + "0" + ], + [ + 1592168400000, + "9380.96000000", + "9385.59000000", + "9319.82000000", + "9346.09000000", + "1405.21572000", + 1592171999999, + "13141349.79999369", + 22353, + "564.83283600", + "5283058.90522037", + "0" + ], + [ + 1592172000000, + "9346.09000000", + "9409.00000000", + "9245.00000000", + "9386.76000000", + "4908.29226400", + 1592175599999, + "45770648.66111531", + 50529, + "2214.97490100", + "20660945.99263311", + "0" + ], + [ + 1592175600000, + "9386.76000000", + "9387.00000000", + "9330.22000000", + "9342.10000000", + "1352.12076700", + 1592179199999, + "12653458.22629687", + 16840, + "597.98609400", + "5595856.63639765", + "0" + ], + [ + 1592179200000, + "9342.10000000", + "9370.81000000", + "9317.50000000", + "9342.39000000", + "1356.56647300", + 1592182799999, + "12674452.50810412", + 18604, + "643.66402400", + "6014338.08532980", + "0" + ], + [ + 1592182800000, + "9341.74000000", + "9343.68000000", + "9231.02000000", + "9251.88000000", + "3306.97709800", + 1592186399999, + "30694234.12959247", + 32811, + "1497.74461600", + "13899181.56272297", + "0" + ], + [ + 1592186400000, + "9251.88000000", + "9288.00000000", + "9234.12000000", + "9266.06000000", + "1833.49003500", + 1592189999999, + "16986992.62468994", + 23791, + "840.62670300", + "7788890.41205424", + "0" + ], + [ + 1592190000000, + "9266.06000000", + "9273.36000000", + "9122.00000000", + "9163.99000000", + "4810.91463400", + 1592193599999, + "44257017.88097676", + 51934, + "2125.15116200", + "19554419.14140470", + "0" + ], + [ + 1592193600000, + "9164.09000000", + "9225.85000000", + "9130.00000000", + "9188.44000000", + "2751.73913400", + 1592197199999, + "25299663.46688867", + 29659, + "1413.83948800", + "13001548.25734626", + "0" + ], + [ + 1592197200000, + "9188.96000000", + "9193.53000000", + "9000.00000000", + "9040.91000000", + "8764.38975900", + 1592200799999, + "79673051.93365948", + 67674, + "3287.25915800", + "29886959.37595230", + "0" + ], + [ + 1592200800000, + "9040.91000000", + "9079.99000000", + "8910.45000000", + "9053.00000000", + "7995.02122800", + 1592204399999, + "71901814.31254295", + 75417, + "3815.21887400", + "34325046.81904684", + "0" + ], + [ + 1592204400000, + "9052.99000000", + "9131.81000000", + "9002.70000000", + "9123.30000000", + "5557.49392200", + 1592207999999, + "50430145.72207762", + 44512, + "2594.13278100", + "23543267.48030971", + "0" + ], + [ + 1592208000000, + "9123.30000000", + "9165.00000000", + "9082.35000000", + "9140.20000000", + "3259.25459800", + 1592211599999, + "29743696.11302299", + 33828, + "1536.43310000", + "14025076.08477022", + "0" + ], + [ + 1592211600000, + "9140.20000000", + "9148.85000000", + "9110.38000000", + "9147.70000000", + "2073.54391900", + 1592215199999, + "18931789.80036087", + 23448, + "1022.56117100", + "9336078.27574057", + "0" + ], + [ + 1592215200000, + "9147.70000000", + "9150.00000000", + "9078.03000000", + "9090.94000000", + "2447.24186500", + 1592218799999, + "22301148.80868169", + 26033, + "1118.45120900", + "10192028.56297377", + "0" + ], + [ + 1592218800000, + "9090.93000000", + "9142.27000000", + "9068.00000000", + "9117.69000000", + "2492.98334900", + 1592222399999, + "22709877.13358739", + 25726, + "1208.54912200", + "11010426.11667452", + "0" + ], + [ + 1592222400000, + "9117.69000000", + "9136.96000000", + "9091.03000000", + "9099.44000000", + "1971.76213500", + 1592225999999, + "17968863.92484145", + 20627, + "906.95299900", + "8266883.29676206", + "0" + ], + [ + 1592226000000, + "9098.91000000", + "9197.73000000", + "9043.19000000", + "9188.10000000", + "3724.37648000", + 1592229599999, + "33931088.01836942", + 39085, + "1915.41735200", + "17453214.23981359", + "0" + ], + [ + 1592229600000, + "9188.10000000", + "9241.49000000", + "9185.31000000", + "9202.23000000", + "4531.29073800", + 1592233199999, + "41727152.27855504", + 42054, + "2376.89614100", + "21889401.69450140", + "0" + ], + [ + 1592233200000, + "9203.06000000", + "9310.96000000", + "9199.99000000", + "9298.00000000", + "5190.80508300", + 1592236799999, + "48124724.79994905", + 45933, + "2876.82521100", + "26673277.55338331", + "0" + ], + [ + 1592236800000, + "9298.01000000", + "9399.00000000", + "9281.81000000", + "9362.92000000", + "5425.77776700", + 1592240399999, + "50763191.02247528", + 48657, + "2523.69405700", + "23615807.62321503", + "0" + ], + [ + 1592240400000, + "9362.92000000", + "9385.00000000", + "9329.59000000", + "9334.23000000", + "1889.76485500", + 1592243999999, + "17679261.85448000", + 21047, + "820.81784200", + "7677414.70898499", + "0" + ], + [ + 1592244000000, + "9333.97000000", + "9449.90000000", + "9333.02000000", + "9418.47000000", + "4448.97205800", + 1592247599999, + "41848385.85288314", + 41762, + "2554.03525400", + "24019088.79778518", + "0" + ], + [ + 1592247600000, + "9417.62000000", + "9450.00000000", + "9395.59000000", + "9418.57000000", + "2660.34909100", + 1592251199999, + "25066625.15027642", + 27468, + "1261.90853300", + "11890536.69008542", + "0" + ], + [ + 1592251200000, + "9418.57000000", + "9488.91000000", + "9400.08000000", + "9477.34000000", + "2722.64598600", + 1592254799999, + "25714400.10072522", + 27538, + "1585.73078000", + "14975379.04805996", + "0" + ], + [ + 1592254800000, + "9477.35000000", + "9495.00000000", + "9410.00000000", + "9434.63000000", + "2554.02091800", + 1592258399999, + "24189074.56906762", + 30244, + "1414.00803500", + "13398185.70237337", + "0" + ], + [ + 1592258400000, + "9434.23000000", + "9461.00000000", + "9392.18000000", + "9418.65000000", + "2823.32804300", + 1592261999999, + "26603720.53562946", + 25089, + "1531.27353000", + "14427355.51773546", + "0" + ], + [ + 1592262000000, + "9418.66000000", + "9459.65000000", + "9415.00000000", + "9426.02000000", + "1515.21553900", + 1592265599999, + "14298470.00954741", + 16580, + "759.55638700", + "7167318.13470317", + "0" + ], + [ + 1592265600000, + "9426.05000000", + "9434.49000000", + "9373.09000000", + "9389.11000000", + "1574.00835400", + 1592269199999, + "14799410.65268591", + 19125, + "704.92001000", + "6627668.80675844", + "0" + ], + [ + 1592269200000, + "9389.11000000", + "9428.00000000", + "9384.51000000", + "9409.27000000", + "1260.44951700", + 1592272799999, + "11859268.32985277", + 16287, + "559.75637000", + "5266360.68781927", + "0" + ], + [ + 1592272800000, + "9409.27000000", + "9465.00000000", + "9383.49000000", + "9458.52000000", + "1859.50930300", + 1592276399999, + "17528486.26601950", + 19613, + "809.25927000", + "7627548.24688221", + "0" + ], + [ + 1592276400000, + "9458.53000000", + "9582.05000000", + "9443.52000000", + "9562.51000000", + "6352.00688200", + 1592279999999, + "60579339.99962192", + 49179, + "4149.08892700", + "39560747.34968509", + "0" + ], + [ + 1592280000000, + "9562.52000000", + "9577.33000000", + "9522.08000000", + "9545.00000000", + "1784.52734700", + 1592283599999, + "17029410.06861247", + 21204, + "853.94744500", + "8150581.54194287", + "0" + ], + [ + 1592283600000, + "9545.08000000", + "9560.00000000", + "9520.00000000", + "9539.80000000", + "1721.42558800", + 1592287199999, + "16414490.66960453", + 18784, + "928.81605100", + "8855834.87160486", + "0" + ], + [ + 1592287200000, + "9540.22000000", + "9554.08000000", + "9455.00000000", + "9471.52000000", + "3143.16378100", + 1592290799999, + "29873762.14206059", + 32366, + "1366.28131900", + "12983151.29549613", + "0" + ], + [ + 1592290800000, + "9471.52000000", + "9518.00000000", + "9459.13000000", + "9504.09000000", + "2004.92923000", + 1592294399999, + "19034540.06325347", + 20619, + "965.57670000", + "9166636.11935409", + "0" + ], + [ + 1592294400000, + "9504.10000000", + "9505.46000000", + "9464.01000000", + "9491.13000000", + "1621.98452500", + 1592297999999, + "15384098.13506084", + 21224, + "694.27150200", + "6584709.92722606", + "0" + ], + [ + 1592298000000, + "9491.14000000", + "9543.47000000", + "9485.00000000", + "9507.65000000", + "2129.79311400", + 1592301599999, + "20257515.82692628", + 25111, + "1076.87240800", + "10243195.96510531", + "0" + ], + [ + 1592301600000, + "9507.66000000", + "9540.00000000", + "9501.65000000", + "9532.80000000", + "1785.19806500", + 1592305199999, + "16998490.53528857", + 18660, + "840.82098300", + "8006929.37324249", + "0" + ], + [ + 1592305200000, + "9531.70000000", + "9532.90000000", + "9488.71000000", + "9509.94000000", + "1701.65310200", + 1592308799999, + "16181911.05680706", + 21523, + "675.63780300", + "6424849.44341233", + "0" + ], + [ + 1592308800000, + "9509.17000000", + "9577.92000000", + "9475.04000000", + "9565.00000000", + "3219.61276300", + 1592312399999, + "30663727.37117187", + 31209, + "1760.87370800", + "16772315.61007801", + "0" + ], + [ + 1592312400000, + "9565.00000000", + "9589.00000000", + "9495.00000000", + "9537.23000000", + "4526.42253400", + 1592315999999, + "43193039.22691821", + 34308, + "1880.48677200", + "17947619.51924889", + "0" + ], + [ + 1592316000000, + "9536.87000000", + "9546.20000000", + "9417.02000000", + "9438.26000000", + "3956.44220500", + 1592319599999, + "37488511.38216483", + 34651, + "1924.45584300", + "18225272.31153424", + "0" + ], + [ + 1592319600000, + "9436.42000000", + "9475.70000000", + "9400.00000000", + "9452.62000000", + "2977.51099000", + 1592323199999, + "28119442.70803495", + 31200, + "1481.53530100", + "13994380.29988187", + "0" + ], + [ + 1592323200000, + "9452.18000000", + "9512.31000000", + "9430.00000000", + "9488.88000000", + "2377.64718600", + 1592326799999, + "22536959.77765479", + 25778, + "1175.05886200", + "11139284.23710176", + "0" + ], + [ + 1592326800000, + "9488.88000000", + "9501.98000000", + "9457.00000000", + "9470.98000000", + "1134.25907200", + 1592330399999, + "10753956.85075716", + 14766, + "577.72538700", + "5477399.50950478", + "0" + ], + [ + 1592330400000, + "9470.98000000", + "9509.45000000", + "9452.38000000", + "9495.42000000", + "1570.20545000", + 1592333999999, + "14900737.43122586", + 17494, + "833.79188200", + "7912833.34562546", + "0" + ], + [ + 1592334000000, + "9495.43000000", + "9510.00000000", + "9471.46000000", + "9507.52000000", + "1205.04002800", + 1592337599999, + "11438737.65754051", + 13829, + "565.91426200", + "5372778.27659758", + "0" + ], + [ + 1592337600000, + "9507.87000000", + "9507.87000000", + "9478.61000000", + "9494.06000000", + "937.94324800", + 1592341199999, + "8903742.44592240", + 11542, + "474.89676300", + "4508086.00279993", + "0" + ], + [ + 1592341200000, + "9493.36000000", + "9530.00000000", + "9492.03000000", + "9504.00000000", + "1360.94977000", + 1592344799999, + "12942563.16859007", + 19743, + "638.21346000", + "6069657.60763855", + "0" + ], + [ + 1592344800000, + "9504.01000000", + "9525.00000000", + "9490.72000000", + "9522.81000000", + "846.55068900", + 1592348399999, + "8046335.43402864", + 12297, + "329.88195000", + "3136479.40184627", + "0" + ], + [ + 1592348400000, + "9522.82000000", + "9537.50000000", + "9501.86000000", + "9525.59000000", + "1001.21418400", + 1592351999999, + "9529791.93998790", + 12969, + "424.75664700", + "4043093.13242112", + "0" + ], + [ + 1592352000000, + "9526.97000000", + "9535.43000000", + "9475.00000000", + "9477.42000000", + "1676.27020500", + 1592355599999, + "15929602.52178288", + 20731, + "557.50968600", + "5297572.42114789", + "0" + ], + [ + 1592355600000, + "9477.44000000", + "9490.19000000", + "9452.10000000", + "9456.77000000", + "944.00623800", + 1592359199999, + "8941818.02115810", + 16258, + "409.63094500", + "3880329.51497334", + "0" + ], + [ + 1592359200000, + "9456.80000000", + "9487.67000000", + "9437.41000000", + "9445.59000000", + "1651.91069000", + 1592362799999, + "15621420.03743558", + 20618, + "594.73785700", + "5625713.25613918", + "0" + ], + [ + 1592362800000, + "9445.59000000", + "9470.00000000", + "9420.00000000", + "9460.37000000", + "1415.94187900", + 1592366399999, + "13378356.62817192", + 17029, + "610.88795200", + "5773481.71067180", + "0" + ], + [ + 1592366400000, + "9460.36000000", + "9479.98000000", + "9442.89000000", + "9466.82000000", + "1082.63692500", + 1592369999999, + "10247035.79163266", + 12987, + "581.43620500", + "5503016.52317431", + "0" + ], + [ + 1592370000000, + "9466.82000000", + "9485.01000000", + "9435.40000000", + "9446.81000000", + "1411.08515200", + 1592373599999, + "13355037.66625447", + 18223, + "669.93615600", + "6343115.48087694", + "0" + ], + [ + 1592373600000, + "9446.80000000", + "9503.37000000", + "9435.00000000", + "9483.44000000", + "1531.02672500", + 1592377199999, + "14508388.28896955", + 21061, + "727.75455900", + "6897158.10651184", + "0" + ], + [ + 1592377200000, + "9483.43000000", + "9534.00000000", + "9474.84000000", + "9513.00000000", + "1720.72677800", + 1592380799999, + "16351444.72078236", + 21534, + "918.72339700", + "8731817.95702926", + "0" + ], + [ + 1592380800000, + "9513.00000000", + "9525.00000000", + "9489.00000000", + "9496.18000000", + "1225.73459900", + 1592384399999, + "11650218.94759258", + 16138, + "510.92517800", + "4856535.71806945", + "0" + ], + [ + 1592384400000, + "9496.03000000", + "9504.01000000", + "9477.00000000", + "9483.88000000", + "1256.98248800", + 1592387999999, + "11927969.37808300", + 14913, + "655.83720200", + "6223482.00720001", + "0" + ], + [ + 1592388000000, + "9484.07000000", + "9502.10000000", + "9479.93000000", + "9483.26000000", + "1479.87250500", + 1592391599999, + "14044110.90073966", + 14872, + "858.74139600", + "8149980.52092964", + "0" + ], + [ + 1592391600000, + "9483.25000000", + "9511.53000000", + "9466.00000000", + "9478.61000000", + "1251.80269700", + 1592395199999, + "11876951.57443754", + 15518, + "608.94902700", + "5777855.93394070", + "0" + ], + [ + 1592395200000, + "9478.61000000", + "9510.88000000", + "9477.35000000", + "9499.25000000", + "1120.42633200", + 1592398799999, + "10641250.53128292", + 18207, + "616.54371600", + "5855860.19978812", + "0" + ], + [ + 1592398800000, + "9499.24000000", + "9565.00000000", + "9432.00000000", + "9443.48000000", + "4401.69300800", + 1592402399999, + "41762059.09879463", + 42223, + "2159.44613600", + "20496483.30927441", + "0" + ], + [ + 1592402400000, + "9442.50000000", + "9464.83000000", + "9366.09000000", + "9410.95000000", + "4802.21112000", + 1592405999999, + "45215077.81766456", + 43802, + "2176.76269700", + "20496285.92219992", + "0" + ], + [ + 1592406000000, + "9411.27000000", + "9436.54000000", + "9388.43000000", + "9399.24000000", + "2077.13528100", + 1592409599999, + "19557053.89636893", + 22278, + "1077.47851400", + "10144354.83503875", + "0" + ], + [ + 1592409600000, + "9399.20000000", + "9419.06000000", + "9358.00000000", + "9368.40000000", + "2600.78190400", + 1592413199999, + "24400832.13620619", + 28999, + "1301.96933800", + "12214836.80151821", + "0" + ], + [ + 1592413200000, + "9368.83000000", + "9430.04000000", + "9362.22000000", + "9402.27000000", + "2634.79030600", + 1592416799999, + "24785047.82716725", + 22664, + "1274.78092000", + "11990140.87967731", + "0" + ], + [ + 1592416800000, + "9402.26000000", + "9418.55000000", + "9388.00000000", + "9401.93000000", + "1789.21253600", + 1592420399999, + "16824333.63406693", + 16788, + "1028.26160300", + "9668931.36707114", + "0" + ], + [ + 1592420400000, + "9402.35000000", + "9405.52000000", + "9298.40000000", + "9300.83000000", + "2973.05917000", + 1592423999999, + "27822154.43485394", + 27484, + "1247.31195500", + "11681224.41605704", + "0" + ], + [ + 1592424000000, + "9302.13000000", + "9395.00000000", + "9236.61000000", + "9379.44000000", + "4540.22366200", + 1592427599999, + "42314822.28162929", + 45760, + "2004.43683300", + "18694564.16132586", + "0" + ], + [ + 1592427600000, + "9379.44000000", + "9450.00000000", + "9378.45000000", + "9416.96000000", + "1709.88045700", + 1592431199999, + "16105965.76792564", + 22368, + "793.20422400", + "7470754.57495775", + "0" + ], + [ + 1592431200000, + "9416.30000000", + "9456.42000000", + "9396.35000000", + "9437.00000000", + "1456.14653800", + 1592434799999, + "13728570.69808541", + 17883, + "803.53418400", + "7576529.30937758", + "0" + ], + [ + 1592434800000, + "9437.00000000", + "9473.33000000", + "9429.56000000", + "9465.14000000", + "1292.85395700", + 1592438399999, + "12220289.62469461", + 17820, + "654.03159600", + "6182700.70697722", + "0" + ], + [ + 1592438400000, + "9465.13000000", + "9471.39000000", + "9411.14000000", + "9434.97000000", + "1406.60589200", + 1592441999999, + "13271994.68747763", + 16606, + "609.37516600", + "5748996.87086016", + "0" + ], + [ + 1592442000000, + "9434.98000000", + "9453.00000000", + "9411.00000000", + "9423.08000000", + "993.04189700", + 1592445599999, + "9365740.15930295", + 15122, + "419.62090900", + "3957276.28113077", + "0" + ], + [ + 1592445600000, + "9423.62000000", + "9430.00000000", + "9401.41000000", + "9411.96000000", + "887.97041200", + 1592449199999, + "8359531.38207160", + 13504, + "365.67568600", + "3442569.60844982", + "0" + ], + [ + 1592449200000, + "9411.96000000", + "9441.61000000", + "9403.19000000", + "9431.28000000", + "813.12636300", + 1592452799999, + "7664561.44422147", + 12123, + "349.56324300", + "3294710.20394426", + "0" + ], + [ + 1592452800000, + "9431.48000000", + "9438.98000000", + "9409.24000000", + "9410.86000000", + "856.04308300", + 1592456399999, + "8066536.61459849", + 13417, + "317.75093500", + "2994311.56526407", + "0" + ], + [ + 1592456400000, + "9410.86000000", + "9435.54000000", + "9407.12000000", + "9425.98000000", + "830.64308900", + 1592459999999, + "7825927.28987074", + 12392, + "434.24298200", + "4091517.30963991", + "0" + ], + [ + 1592460000000, + "9426.52000000", + "9455.00000000", + "9412.07000000", + "9430.97000000", + "1371.83623900", + 1592463599999, + "12940462.60038346", + 15876, + "774.45802200", + "7306175.11395624", + "0" + ], + [ + 1592463600000, + "9430.99000000", + "9451.94000000", + "9428.39000000", + "9440.34000000", + "1152.82073200", + 1592467199999, + "10883662.07307543", + 17075, + "562.46513300", + "5310550.86637081", + "0" + ], + [ + 1592467200000, + "9440.82000000", + "9458.51000000", + "9430.76000000", + "9437.94000000", + "1342.59482600", + 1592470799999, + "12678061.68808434", + 17079, + "578.64436800", + "5464101.92723404", + "0" + ], + [ + 1592470800000, + "9437.94000000", + "9489.00000000", + "9405.00000000", + "9411.45000000", + "2428.07638900", + 1592474399999, + "22945306.65567327", + 24549, + "1326.84006500", + "12545985.08505890", + "0" + ], + [ + 1592474400000, + "9412.15000000", + "9453.93000000", + "9380.00000000", + "9453.81000000", + "1614.20927100", + 1592477999999, + "15212393.29778110", + 21649, + "739.37159000", + "6968375.50192597", + "0" + ], + [ + 1592478000000, + "9453.81000000", + "9463.00000000", + "9424.48000000", + "9432.67000000", + "1214.68398900", + 1592481599999, + "11470916.08110959", + 18034, + "585.12550700", + "5525683.93184099", + "0" + ], + [ + 1592481600000, + "9432.67000000", + "9445.00000000", + "9419.00000000", + "9426.00000000", + "1591.38069200", + 1592485199999, + "15005575.55914055", + 21319, + "889.96214500", + "8392187.49055713", + "0" + ], + [ + 1592485200000, + "9426.00000000", + "9427.21000000", + "9382.00000000", + "9403.01000000", + "2750.30396300", + 1592488799999, + "25878146.50408218", + 28799, + "1301.59833300", + "12247553.99792296", + "0" + ], + [ + 1592488800000, + "9403.01000000", + "9433.29000000", + "9388.00000000", + "9431.50000000", + "1608.67982800", + 1592492399999, + "15137659.71235827", + 20326, + "866.08763600", + "8150810.11842015", + "0" + ], + [ + 1592492400000, + "9432.07000000", + "9438.77000000", + "9381.00000000", + "9385.99000000", + "1627.72146600", + 1592495999999, + "15323124.64759416", + 22163, + "736.01632400", + "6930169.78886340", + "0" + ], + [ + 1592496000000, + "9385.99000000", + "9411.67000000", + "9376.05000000", + "9400.93000000", + "2098.99046700", + 1592499599999, + "19722170.78230028", + 26713, + "1076.38401700", + "10114871.59727989", + "0" + ], + [ + 1592499600000, + "9400.93000000", + "9419.64000000", + "9388.36000000", + "9405.00000000", + "1286.03559000", + 1592503199999, + "12095176.35989193", + 15704, + "635.21010300", + "5975014.64937740", + "0" + ], + [ + 1592503200000, + "9405.00000000", + "9410.30000000", + "9385.04000000", + "9396.75000000", + "1136.02902400", + 1592506799999, + "10676433.19468595", + 14881, + "584.45808000", + "5493143.97505895", + "0" + ], + [ + 1592506800000, + "9396.75000000", + "9417.26000000", + "9335.50000000", + "9397.99000000", + "2506.60460800", + 1592510399999, + "23526524.82662222", + 25434, + "1161.76180900", + "10906407.84473975", + "0" + ], + [ + 1592510400000, + "9397.99000000", + "9404.28000000", + "9313.00000000", + "9343.97000000", + "2912.98971000", + 1592513999999, + "27274450.48526611", + 34765, + "1413.96269200", + "13241716.49505683", + "0" + ], + [ + 1592514000000, + "9343.98000000", + "9390.84000000", + "9280.00000000", + "9371.28000000", + "2704.20581500", + 1592517599999, + "25228386.65036979", + 35498, + "1173.72842700", + "10954026.28356991", + "0" + ], + [ + 1592517600000, + "9371.28000000", + "9395.00000000", + "9361.37000000", + "9379.98000000", + "1069.32329700", + 1592521199999, + "10027449.13949667", + 15924, + "482.10529600", + "4521334.25673934", + "0" + ], + [ + 1592521200000, + "9379.63000000", + "9416.65000000", + "9367.65000000", + "9386.32000000", + "1178.03712300", + 1592524799999, + "11069363.23708051", + 16122, + "555.99678500", + "5224067.61607063", + "0" + ], + [ + 1592524800000, + "9386.32000000", + "9388.71000000", + "9325.16000000", + "9371.79000000", + "2276.91987400", + 1592528399999, + "21314891.87288114", + 22940, + "1208.25251400", + "11311387.69655917", + "0" + ], + [ + 1592528400000, + "9371.79000000", + "9382.54000000", + "9317.81000000", + "9323.45000000", + "1631.46528300", + 1592531999999, + "15254992.09328886", + 19382, + "688.47330400", + "6439004.07412887", + "0" + ], + [ + 1592532000000, + "9324.08000000", + "9341.98000000", + "9215.79000000", + "9274.99000000", + "3230.47113900", + 1592535599999, + "30012886.33997078", + 29787, + "1393.49687300", + "12953300.59104405", + "0" + ], + [ + 1592535600000, + "9274.98000000", + "9311.00000000", + "9239.45000000", + "9274.26000000", + "2577.85672300", + 1592539199999, + "23915258.67369441", + 26303, + "1484.75983100", + "13773977.90094030", + "0" + ], + [ + 1592539200000, + "9274.27000000", + "9330.57000000", + "9257.30000000", + "9305.21000000", + "1890.11848400", + 1592542799999, + "17582152.38910012", + 20329, + "849.53813400", + "7900706.51711913", + "0" + ], + [ + 1592542800000, + "9305.30000000", + "9327.95000000", + "9300.54000000", + "9326.85000000", + "1199.91572200", + 1592546399999, + "11172884.94022946", + 15426, + "616.39073300", + "5739592.49608618", + "0" + ], + [ + 1592546400000, + "9325.56000000", + "9335.02000000", + "9309.34000000", + "9310.43000000", + "1083.41593600", + 1592549999999, + "10099597.49313534", + 16565, + "485.83240500", + "4529182.86609720", + "0" + ], + [ + 1592550000000, + "9311.28000000", + "9311.28000000", + "9258.18000000", + "9299.52000000", + "2285.64952000", + 1592553599999, + "21224282.80339656", + 22075, + "1070.30460800", + "9939165.86259213", + "0" + ], + [ + 1592553600000, + "9299.53000000", + "9324.21000000", + "9274.20000000", + "9314.79000000", + "1691.05096400", + 1592557199999, + "15728066.65538386", + 21650, + "766.00089700", + "7125557.45801859", + "0" + ], + [ + 1592557200000, + "9314.80000000", + "9438.30000000", + "9314.80000000", + "9363.57000000", + "4133.18982900", + 1592560799999, + "38754095.45288891", + 39659, + "2328.03360200", + "21829092.92878612", + "0" + ], + [ + 1592560800000, + "9363.82000000", + "9394.99000000", + "9355.77000000", + "9391.73000000", + "1456.43723800", + 1592564399999, + "13654378.89046419", + 19033, + "713.02098800", + "6684635.46753541", + "0" + ], + [ + 1592564400000, + "9391.69000000", + "9403.00000000", + "9369.58000000", + "9385.84000000", + "1767.54434300", + 1592567999999, + "16589734.39275218", + 19224, + "1017.15811100", + "9547472.25283262", + "0" + ], + [ + 1592568000000, + "9385.84000000", + "9423.00000000", + "9369.27000000", + "9384.00000000", + "2539.82929600", + 1592571599999, + "23876529.64765071", + 27122, + "1324.77610400", + "12455573.03673685", + "0" + ], + [ + 1592571600000, + "9384.00000000", + "9405.28000000", + "9365.00000000", + "9389.99000000", + "1492.88914800", + 1592575199999, + "14013398.09947902", + 20743, + "727.35353500", + "6828425.29292768", + "0" + ], + [ + 1592575200000, + "9390.00000000", + "9398.47000000", + "9356.37000000", + "9364.00000000", + "1477.85325800", + 1592578799999, + "13864536.86554564", + 17561, + "566.19415500", + "5311633.97788102", + "0" + ], + [ + 1592578800000, + "9363.66000000", + "9383.57000000", + "9346.27000000", + "9383.32000000", + "1297.40039700", + 1592582399999, + "12153559.63334952", + 16437, + "649.41402700", + "6083741.72372019", + "0" + ], + [ + 1592582400000, + "9383.35000000", + "9386.83000000", + "9313.01000000", + "9340.45000000", + "2150.70265200", + 1592585999999, + "20092106.11701580", + 26501, + "971.08398000", + "9070788.65406819", + "0" + ], + [ + 1592586000000, + "9340.45000000", + "9350.00000000", + "9288.26000000", + "9313.19000000", + "2150.26564500", + 1592589599999, + "20043051.89138146", + 20921, + "943.92121400", + "8800996.83887983", + "0" + ], + [ + 1592589600000, + "9313.11000000", + "9342.64000000", + "9267.81000000", + "9325.00000000", + "2227.05385800", + 1592593199999, + "20720909.03025044", + 22497, + "1019.57177100", + "9487336.33275306", + "0" + ], + [ + 1592593200000, + "9325.00000000", + "9345.00000000", + "9305.02000000", + "9307.37000000", + "1169.79785900", + 1592596799999, + "10908031.97863696", + 14945, + "569.42149100", + "5309418.29885411", + "0" + ], + [ + 1592596800000, + "9307.36000000", + "9324.32000000", + "9260.00000000", + "9324.27000000", + "2073.24908500", + 1592600399999, + "19265552.38473669", + 20184, + "978.05597500", + "9088616.74812857", + "0" + ], + [ + 1592600400000, + "9324.26000000", + "9344.62000000", + "9290.00000000", + "9331.50000000", + "868.51858400", + 1592603999999, + "8089976.58005532", + 14685, + "479.18584300", + "4462870.93658694", + "0" + ], + [ + 1592604000000, + "9331.50000000", + "9354.40000000", + "9287.36000000", + "9300.00000000", + "1185.06015400", + 1592607599999, + "11050679.33872793", + 14427, + "571.75158800", + "5332901.59267291", + "0" + ], + [ + 1592607600000, + "9299.99000000", + "9319.36000000", + "9275.00000000", + "9310.23000000", + "1474.32868200", + 1592611199999, + "13705411.62872297", + 15088, + "633.97736300", + "5892988.79520000", + "0" + ], + [ + 1592611200000, + "9310.23000000", + "9338.84000000", + "9292.29000000", + "9302.24000000", + "1182.75938300", + 1592614799999, + "11019827.89658105", + 15180, + "540.87570900", + "5039871.08003942", + "0" + ], + [ + 1592614800000, + "9302.66000000", + "9329.00000000", + "9286.97000000", + "9315.22000000", + "927.21092100", + 1592618399999, + "8637313.27131388", + 12663, + "468.18012100", + "4361356.01857467", + "0" + ], + [ + 1592618400000, + "9315.22000000", + "9326.15000000", + "9307.28000000", + "9321.77000000", + "746.73992600", + 1592621999999, + "6957566.93842103", + 10105, + "375.71066500", + "3500998.89671354", + "0" + ], + [ + 1592622000000, + "9321.93000000", + "9350.00000000", + "9321.91000000", + "9330.65000000", + "897.84597300", + 1592625599999, + "8381696.10039052", + 12016, + "472.49234200", + "4410355.03879192", + "0" + ], + [ + 1592625600000, + "9330.64000000", + "9333.42000000", + "9293.40000000", + "9320.47000000", + "980.19457900", + 1592629199999, + "9130797.76719773", + 14151, + "408.77017700", + "3807399.61439161", + "0" + ], + [ + 1592629200000, + "9321.37000000", + "9331.01000000", + "9307.29000000", + "9313.03000000", + "598.60359000", + 1592632799999, + "5577459.94990480", + 10248, + "264.54266400", + "2464692.07720892", + "0" + ], + [ + 1592632800000, + "9313.11000000", + "9332.42000000", + "9305.86000000", + "9322.93000000", + "833.70298700", + 1592636399999, + "7769483.92047238", + 10778, + "421.75425400", + "3930649.42153342", + "0" + ], + [ + 1592636400000, + "9322.85000000", + "9327.91000000", + "9295.00000000", + "9302.88000000", + "1157.25305200", + 1592639999999, + "10775754.12711241", + 13228, + "550.13750400", + "5123326.58316651", + "0" + ], + [ + 1592640000000, + "9303.41000000", + "9314.32000000", + "9283.00000000", + "9287.24000000", + "1817.60468800", + 1592643599999, + "16896925.09199536", + 18399, + "855.53235900", + "7953835.05183950", + "0" + ], + [ + 1592643600000, + "9287.11000000", + "9305.25000000", + "9275.00000000", + "9289.83000000", + "1405.40992500", + 1592647199999, + "13055492.45947538", + 16531, + "736.96170700", + "6846220.39277139", + "0" + ], + [ + 1592647200000, + "9290.02000000", + "9298.84000000", + "9279.89000000", + "9291.85000000", + "835.76302100", + 1592650799999, + "7765906.68340350", + 12487, + "452.32987600", + "4203061.82385336", + "0" + ], + [ + 1592650800000, + "9291.85000000", + "9380.00000000", + "9170.95000000", + "9325.87000000", + "5114.66913600", + 1592654399999, + "47440804.81029871", + 49140, + "2435.28443400", + "22616232.90327745", + "0" + ], + [ + 1592654400000, + "9325.87000000", + "9335.07000000", + "9300.00000000", + "9305.00000000", + "1047.36340200", + 1592657999999, + "9756825.76182625", + 14643, + "458.25287700", + "4268683.37784764", + "0" + ], + [ + 1592658000000, + "9305.00000000", + "9315.98000000", + "9281.43000000", + "9288.55000000", + "890.21768400", + 1592661599999, + "8273945.69275996", + 13529, + "399.78405800", + "3715809.59998587", + "0" + ], + [ + 1592661600000, + "9290.05000000", + "9299.86000000", + "9273.91000000", + "9284.12000000", + "990.66390300", + 1592665199999, + "9201822.55236456", + 14752, + "537.74033100", + "4995294.25448479", + "0" + ], + [ + 1592665200000, + "9284.12000000", + "9287.08000000", + "9232.33000000", + "9259.78000000", + "1804.67049500", + 1592668799999, + "16715135.17577233", + 25085, + "885.89983500", + "8206268.85786856", + "0" + ], + [ + 1592668800000, + "9258.82000000", + "9284.72000000", + "9241.00000000", + "9266.64000000", + "1085.60333200", + 1592672399999, + "10064924.99751255", + 16074, + "522.84517000", + "4847554.57162690", + "0" + ], + [ + 1592672400000, + "9265.99000000", + "9287.24000000", + "9265.08000000", + "9272.39000000", + "1096.71723700", + 1592675999999, + "10170544.57310401", + 12828, + "546.18176300", + "5065605.09575961", + "0" + ], + [ + 1592676000000, + "9272.01000000", + "9314.00000000", + "9272.00000000", + "9312.51000000", + "1117.88683600", + 1592679599999, + "10381942.78770972", + 14021, + "664.60447000", + "6172503.94384830", + "0" + ], + [ + 1592679600000, + "9312.54000000", + "9319.45000000", + "9285.28000000", + "9286.54000000", + "1145.51340300", + 1592683199999, + "10654124.40722616", + 14132, + "536.27872300", + "4988142.74343561", + "0" + ], + [ + 1592683200000, + "9286.46000000", + "9329.75000000", + "9286.46000000", + "9318.78000000", + "1059.62800400", + 1592686799999, + "9868371.00909863", + 14134, + "530.52463600", + "4940267.39934234", + "0" + ], + [ + 1592686800000, + "9318.84000000", + "9350.00000000", + "9317.25000000", + "9333.78000000", + "1070.43882500", + 1592690399999, + "9993538.57730249", + 15855, + "654.91839300", + "6115435.54604001", + "0" + ], + [ + 1592690400000, + "9333.78000000", + "9395.00000000", + "9333.03000000", + "9375.00000000", + "1774.46217200", + 1592693999999, + "16628836.75854929", + 21925, + "1053.54425800", + "9874384.13129025", + "0" + ], + [ + 1592694000000, + "9375.01000000", + "9380.00000000", + "9341.43000000", + "9358.95000000", + "748.14291000", + 1592697599999, + "7001319.24695991", + 10874, + "351.93544300", + "3293577.19699169", + "0" + ], + [ + 1592697600000, + "9358.95000000", + "9380.79000000", + "9344.13000000", + "9358.31000000", + "950.30839600", + 1592701199999, + "8896965.46287994", + 15472, + "465.63882200", + "4359650.10477733", + "0" + ], + [ + 1592701200000, + "9357.82000000", + "9378.90000000", + "9355.80000000", + "9374.69000000", + "891.76810700", + 1592704799999, + "8354508.95520251", + 12850, + "423.57415400", + "3968155.07659230", + "0" + ], + [ + 1592704800000, + "9374.67000000", + "9400.00000000", + "9361.57000000", + "9370.00000000", + "1494.94380600", + 1592708399999, + "14029683.94481724", + 17340, + "801.93147000", + "7526907.81540880", + "0" + ], + [ + 1592708400000, + "9370.00000000", + "9378.67000000", + "9360.37000000", + "9371.78000000", + "558.96758800", + 1592711999999, + "5236387.65145052", + 9876, + "276.72641500", + "2592496.75621128", + "0" + ], + [ + 1592712000000, + "9371.82000000", + "9380.00000000", + "9367.72000000", + "9370.92000000", + "632.13335000", + 1592715599999, + "5925722.37783073", + 9872, + "285.63949400", + "2677658.84949248", + "0" + ], + [ + 1592715600000, + "9370.99000000", + "9395.61000000", + "9370.60000000", + "9388.02000000", + "829.10926800", + 1592719199999, + "7779004.23912069", + 10971, + "425.70567500", + "3994150.72508351", + "0" + ], + [ + 1592719200000, + "9388.01000000", + "9422.00000000", + "9369.23000000", + "9370.87000000", + "1601.63464600", + 1592722799999, + "15043138.37597351", + 15444, + "873.46625000", + "8203875.49094705", + "0" + ], + [ + 1592722800000, + "9371.04000000", + "9382.99000000", + "9356.05000000", + "9368.98000000", + "1223.42239000", + 1592726399999, + "11465571.54594319", + 13077, + "712.82049400", + "6680721.66059921", + "0" + ], + [ + 1592726400000, + "9369.46000000", + "9375.00000000", + "9357.35000000", + "9362.81000000", + "750.91882400", + 1592729999999, + "7033315.59698895", + 11640, + "324.32170500", + "3037772.06050434", + "0" + ], + [ + 1592730000000, + "9363.24000000", + "9385.26000000", + "9362.00000000", + "9363.44000000", + "817.61290800", + 1592733599999, + "7663295.81090608", + 9582, + "370.02929600", + "3468219.16711805", + "0" + ], + [ + 1592733600000, + "9363.45000000", + "9365.39000000", + "9331.00000000", + "9357.91000000", + "1366.45766500", + 1592737199999, + "12777539.80436034", + 13333, + "649.99142400", + "6077822.25319466", + "0" + ], + [ + 1592737200000, + "9357.91000000", + "9363.63000000", + "9339.53000000", + "9358.50000000", + "769.69113800", + 1592740799999, + "7197734.77569408", + 10532, + "398.35494100", + "3725300.89057751", + "0" + ], + [ + 1592740800000, + "9358.50000000", + "9363.51000000", + "9341.92000000", + "9347.06000000", + "726.50462500", + 1592744399999, + "6793414.42529706", + 10738, + "340.04696900", + "3179814.08587308", + "0" + ], + [ + 1592744400000, + "9347.06000000", + "9354.38000000", + "9321.71000000", + "9349.00000000", + "1105.99172900", + 1592747999999, + "10331795.41637328", + 14351, + "503.68473000", + "4705631.36095476", + "0" + ], + [ + 1592748000000, + "9348.53000000", + "9359.50000000", + "9335.94000000", + "9352.00000000", + "873.06950300", + 1592751599999, + "8161284.28779352", + 12965, + "446.02474800", + "4169366.23400553", + "0" + ], + [ + 1592751600000, + "9352.01000000", + "9393.00000000", + "9347.21000000", + "9373.33000000", + "1279.02098400", + 1592755199999, + "11981007.46533394", + 18149, + "679.90070500", + "6369530.51822747", + "0" + ], + [ + 1592755200000, + "9373.33000000", + "9379.58000000", + "9342.15000000", + "9366.36000000", + "1066.49143300", + 1592758799999, + "9984727.19103455", + 16881, + "515.32380700", + "4824678.52211795", + "0" + ], + [ + 1592758800000, + "9365.84000000", + "9367.47000000", + "9343.32000000", + "9347.00000000", + "862.53487900", + 1592762399999, + "8067443.48757993", + 11822, + "362.40748900", + "3389774.79730890", + "0" + ], + [ + 1592762400000, + "9346.99000000", + "9350.04000000", + "9307.00000000", + "9315.22000000", + "1598.35655000", + 1592765999999, + "14906658.33523077", + 17783, + "671.62459700", + "6263634.96937622", + "0" + ], + [ + 1592766000000, + "9315.21000000", + "9356.32000000", + "9302.00000000", + "9351.13000000", + "1028.47053000", + 1592769599999, + "9601725.87915083", + 14663, + "539.30361900", + "5036053.26761221", + "0" + ], + [ + 1592769600000, + "9351.14000000", + "9354.29000000", + "9306.14000000", + "9324.08000000", + "1050.90257700", + 1592773199999, + "9808151.70201663", + 12399, + "451.51127800", + "4215234.23267636", + "0" + ], + [ + 1592773200000, + "9324.07000000", + "9341.85000000", + "9321.07000000", + "9333.69000000", + "573.31770700", + 1592776799999, + "5349827.48232696", + 10429, + "300.37869900", + "2803195.87925991", + "0" + ], + [ + 1592776800000, + "9333.70000000", + "9333.70000000", + "9285.73000000", + "9313.14000000", + "1449.69667900", + 1592780399999, + "13495444.73863679", + 17896, + "568.16068700", + "5289071.44222187", + "0" + ], + [ + 1592780400000, + "9313.14000000", + "9316.80000000", + "9281.54000000", + "9294.69000000", + "815.60095200", + 1592783999999, + "7583591.65826916", + 12950, + "393.22971400", + "3656788.39523784", + "0" + ], + [ + 1592784000000, + "9294.69000000", + "9336.05000000", + "9277.09000000", + "9322.95000000", + "1049.09729200", + 1592787599999, + "9768670.86940288", + 14694, + "529.09122900", + "4926105.72650661", + "0" + ], + [ + 1592787600000, + "9322.95000000", + "9394.41000000", + "9322.07000000", + "9389.63000000", + "1925.49597300", + 1592791199999, + "18015142.64451827", + 22018, + "896.82022800", + "8391967.10480680", + "0" + ], + [ + 1592791200000, + "9388.84000000", + "9399.99000000", + "9365.02000000", + "9386.63000000", + "1331.55715600", + 1592794799999, + "12491728.29799118", + 17247, + "613.83534100", + "5759007.26977325", + "0" + ], + [ + 1592794800000, + "9386.63000000", + "9393.74000000", + "9370.58000000", + "9385.69000000", + "1136.52485100", + 1592798399999, + "10661956.68047790", + 14366, + "483.83803000", + "4538666.34492136", + "0" + ], + [ + 1592798400000, + "9385.69000000", + "9425.66000000", + "9376.14000000", + "9411.08000000", + "2359.35779100", + 1592801999999, + "22181173.27238218", + 24111, + "1039.68396000", + "9774064.77457879", + "0" + ], + [ + 1592802000000, + "9411.29000000", + "9450.00000000", + "9407.03000000", + "9414.71000000", + "2653.20695600", + 1592805599999, + "25025217.47938538", + 27836, + "1458.05357300", + "13754019.17558195", + "0" + ], + [ + 1592805600000, + "9414.67000000", + "9433.92000000", + "9402.54000000", + "9416.02000000", + "1410.80308700", + 1592809199999, + "13286918.38512098", + 17612, + "826.13779900", + "7780993.95058562", + "0" + ], + [ + 1592809200000, + "9416.29000000", + "9442.00000000", + "9406.01000000", + "9419.00000000", + "1493.87285900", + 1592812799999, + "14081006.55117441", + 16559, + "777.49181200", + "7328639.72082831", + "0" + ], + [ + 1592812800000, + "9419.01000000", + "9434.06000000", + "9399.80000000", + "9432.20000000", + "1825.91150800", + 1592816399999, + "17194787.22035656", + 18062, + "857.16537300", + "8073476.19697545", + "0" + ], + [ + 1592816400000, + "9431.25000000", + "9435.99000000", + "9410.62000000", + "9417.48000000", + "1345.43552300", + 1592819999999, + "12676974.33354432", + 16965, + "662.83354700", + "6245788.98436644", + "0" + ], + [ + 1592820000000, + "9417.48000000", + "9438.67000000", + "9412.24000000", + "9434.87000000", + "1569.28515000", + 1592823599999, + "14796189.29937736", + 18271, + "812.31098400", + "7659334.91107035", + "0" + ], + [ + 1592823600000, + "9434.86000000", + "9473.03000000", + "9421.07000000", + "9459.40000000", + "2588.47599500", + 1592827199999, + "24452457.31044884", + 25915, + "1355.19570400", + "12803995.42448440", + "0" + ], + [ + 1592827200000, + "9459.84000000", + "9500.00000000", + "9442.51000000", + "9493.50000000", + "3732.12089400", + 1592830799999, + "35354776.43058774", + 31959, + "2143.04604000", + "20305203.54420054", + "0" + ], + [ + 1592830800000, + "9493.50000000", + "9509.73000000", + "9451.64000000", + "9468.45000000", + "2476.02267200", + 1592834399999, + "23466426.75232121", + 24477, + "1143.38593200", + "10836405.28255255", + "0" + ], + [ + 1592834400000, + "9468.60000000", + "9480.00000000", + "9454.77000000", + "9460.01000000", + "1993.66831900", + 1592837999999, + "18875680.85769477", + 20863, + "1056.89693100", + "10006881.96714758", + "0" + ], + [ + 1592838000000, + "9460.00000000", + "9497.00000000", + "9459.03000000", + "9492.26000000", + "2080.09678700", + 1592841599999, + "19712584.42686521", + 25586, + "1153.87112000", + "10935614.13027310", + "0" + ], + [ + 1592841600000, + "9492.25000000", + "9629.34000000", + "9474.13000000", + "9586.17000000", + "7127.10536500", + 1592845199999, + "68125424.61935121", + 56929, + "4190.44861600", + "40062434.34287380", + "0" + ], + [ + 1592845200000, + "9584.73000000", + "9613.09000000", + "9551.00000000", + "9587.21000000", + "3321.59715300", + 1592848799999, + "31815953.69367860", + 29028, + "1760.30265500", + "16861713.94213428", + "0" + ], + [ + 1592848800000, + "9587.20000000", + "9595.54000000", + "9570.76000000", + "9581.62000000", + "1557.00424200", + 1592852399999, + "14919585.83381789", + 17725, + "772.90018000", + "7406644.59014876", + "0" + ], + [ + 1592852400000, + "9582.14000000", + "9592.82000000", + "9541.05000000", + "9563.47000000", + "1840.90829900", + 1592855999999, + "17609958.79574058", + 18194, + "866.35914600", + "8287375.35677985", + "0" + ], + [ + 1592856000000, + "9563.51000000", + "9667.11000000", + "9563.47000000", + "9639.14000000", + "3295.34607300", + 1592859599999, + "31693498.47268075", + 28674, + "2116.50718800", + "20359215.77503412", + "0" + ], + [ + 1592859600000, + "9639.15000000", + "9780.00000000", + "9639.15000000", + "9689.21000000", + "6121.44763100", + 1592863199999, + "59393233.03762973", + 61845, + "3475.42884000", + "33725480.10189863", + "0" + ], + [ + 1592863200000, + "9688.58000000", + "9689.47000000", + "9631.44000000", + "9678.85000000", + "2333.09869600", + 1592866799999, + "22542145.97646189", + 23236, + "1070.20099900", + "10342752.71994883", + "0" + ], + [ + 1592866800000, + "9679.00000000", + "9697.47000000", + "9660.84000000", + "9685.69000000", + "1328.02807100", + 1592870399999, + "12854307.82846062", + 16532, + "676.39514800", + "6546996.80600475", + "0" + ], + [ + 1592870400000, + "9685.69000000", + "9720.00000000", + "9658.97000000", + "9660.23000000", + "2036.69697400", + 1592873999999, + "19740286.11237479", + 23410, + "961.51184100", + "9320691.63579615", + "0" + ], + [ + 1592874000000, + "9660.09000000", + "9673.00000000", + "9604.04000000", + "9646.59000000", + "3735.78907500", + 1592877599999, + "36000854.83752096", + 31177, + "1543.42548200", + "14873431.31118955", + "0" + ], + [ + 1592877600000, + "9646.82000000", + "9657.13000000", + "9624.01000000", + "9641.66000000", + "1609.66351900", + 1592881199999, + "15522830.09000635", + 17949, + "777.31950400", + "7496514.01773059", + "0" + ], + [ + 1592881200000, + "9641.84000000", + "9662.49000000", + "9623.50000000", + "9658.22000000", + "1176.70044700", + 1592884799999, + "11347497.91346620", + 12830, + "555.50321900", + "5356439.16480320", + "0" + ], + [ + 1592884800000, + "9657.87000000", + "9657.87000000", + "9625.92000000", + "9626.93000000", + "1285.43008400", + 1592888399999, + "12389620.40899589", + 14581, + "550.19586100", + "5303178.13051696", + "0" + ], + [ + 1592888400000, + "9626.72000000", + "9642.63000000", + "9621.29000000", + "9625.68000000", + "897.70529600", + 1592891999999, + "8646261.94679080", + 13244, + "388.79255300", + "3744673.34675424", + "0" + ], + [ + 1592892000000, + "9625.77000000", + "9637.87000000", + "9620.07000000", + "9635.14000000", + "956.91906500", + 1592895599999, + "9214351.54956557", + 13124, + "436.86694200", + "4206518.26023290", + "0" + ], + [ + 1592895600000, + "9636.10000000", + "9667.86000000", + "9621.88000000", + "9663.63000000", + "1534.31180100", + 1592899199999, + "14796710.58353875", + 19759, + "716.05377700", + "6906147.42167099", + "0" + ], + [ + 1592899200000, + "9663.63000000", + "9664.96000000", + "9577.03000000", + "9610.02000000", + "3476.38515000", + 1592902799999, + "33428966.53133940", + 29568, + "1349.95198500", + "12980929.54726110", + "0" + ], + [ + 1592902800000, + "9610.03000000", + "9621.73000000", + "9577.43000000", + "9603.91000000", + "1928.59112500", + 1592906399999, + "18512881.71582437", + 21958, + "979.62483200", + "9404145.46986984", + "0" + ], + [ + 1592906400000, + "9603.91000000", + "9609.60000000", + "9579.00000000", + "9587.74000000", + "1473.93715000", + 1592909999999, + "14143607.35334675", + 19031, + "664.85032400", + "6379592.22755920", + "0" + ], + [ + 1592910000000, + "9587.71000000", + "9645.00000000", + "9586.11000000", + "9633.16000000", + "1755.93214600", + 1592913599999, + "16892496.81513228", + 18989, + "887.86258500", + "8542384.21762671", + "0" + ], + [ + 1592913600000, + "9634.09000000", + "9650.00000000", + "9614.00000000", + "9631.07000000", + "1784.43292700", + 1592917199999, + "17191205.89552001", + 24071, + "805.13966000", + "7757234.66217390", + "0" + ], + [ + 1592917200000, + "9631.69000000", + "9646.23000000", + "9613.56000000", + "9636.79000000", + "1725.09716500", + 1592920799999, + "16615438.05737662", + 23856, + "784.70701100", + "7557960.13556388", + "0" + ], + [ + 1592920800000, + "9636.18000000", + "9668.00000000", + "9623.03000000", + "9644.65000000", + "2211.26578400", + 1592924399999, + "21336564.58547487", + 27400, + "1257.50095000", + "12134466.09953108", + "0" + ], + [ + 1592924400000, + "9644.66000000", + "9692.42000000", + "9633.14000000", + "9691.99000000", + "2406.56160500", + 1592927999999, + "23266388.30423869", + 27444, + "1243.83063800", + "12026318.55525989", + "0" + ], + [ + 1592928000000, + "9691.99000000", + "9695.00000000", + "9650.70000000", + "9661.95000000", + "1949.21126000", + 1592931599999, + "18844323.19672995", + 24097, + "1013.08963700", + "9793516.77987257", + "0" + ], + [ + 1592931600000, + "9661.95000000", + "9670.04000000", + "9638.89000000", + "9664.18000000", + "1692.30279700", + 1592935199999, + "16337106.05439151", + 19341, + "882.67052800", + "8521911.47387029", + "0" + ], + [ + 1592935200000, + "9664.53000000", + "9680.00000000", + "9639.57000000", + "9652.80000000", + "1494.24108400", + 1592938799999, + "14435408.66076153", + 18541, + "728.70136000", + "7040273.01773609", + "0" + ], + [ + 1592938800000, + "9652.80000000", + "9668.99000000", + "9640.00000000", + "9640.48000000", + "1203.39955000", + 1592942399999, + "11618992.40910377", + 14153, + "580.45583900", + "5604876.76734407", + "0" + ], + [ + 1592942400000, + "9640.02000000", + "9660.98000000", + "9625.60000000", + "9626.43000000", + "928.25900100", + 1592945999999, + "8953447.34501647", + 13679, + "365.53086300", + "3526308.66540674", + "0" + ], + [ + 1592946000000, + "9626.43000000", + "9645.00000000", + "9590.00000000", + "9640.44000000", + "1336.80188700", + 1592949599999, + "12862898.14466133", + 16399, + "587.12020100", + "5651005.23478080", + "0" + ], + [ + 1592949600000, + "9640.03000000", + "9652.46000000", + "9595.00000000", + "9610.79000000", + "1469.40356000", + 1592953199999, + "14143159.36147336", + 16149, + "578.88183400", + "5571914.46366224", + "0" + ], + [ + 1592953200000, + "9611.94000000", + "9626.57000000", + "9595.91000000", + "9624.89000000", + "961.99092800", + 1592956799999, + "9246318.58822777", + 13569, + "473.01879000", + "4546986.24319937", + "0" + ], + [ + 1592956800000, + "9624.33000000", + "9645.10000000", + "9613.99000000", + "9626.70000000", + "876.84375300", + 1592960399999, + "8443607.70522396", + 13956, + "449.22118400", + "4325681.41884426", + "0" + ], + [ + 1592960400000, + "9626.70000000", + "9652.91000000", + "9612.88000000", + "9646.72000000", + "830.97074300", + 1592963999999, + "8003846.52893858", + 9671, + "436.22779100", + "4202474.58816236", + "0" + ], + [ + 1592964000000, + "9646.73000000", + "9665.00000000", + "9638.17000000", + "9661.74000000", + "1066.15178100", + 1592967599999, + "10288650.70916630", + 11550, + "486.89059600", + "4698493.43671465", + "0" + ], + [ + 1592967600000, + "9661.74000000", + "9665.00000000", + "9641.01000000", + "9651.16000000", + "981.81436400", + 1592971199999, + "9474930.07435600", + 10300, + "393.11827800", + "3794086.40668436", + "0" + ], + [ + 1592971200000, + "9651.23000000", + "9670.00000000", + "9640.99000000", + "9654.33000000", + "1232.67204700", + 1592974799999, + "11901715.84700867", + 13587, + "488.28606300", + "4715143.91343858", + "0" + ], + [ + 1592974800000, + "9653.01000000", + "9662.59000000", + "9633.54000000", + "9648.21000000", + "1674.95874000", + 1592978399999, + "16156957.13787363", + 15600, + "671.12260400", + "6474023.73902053", + "0" + ], + [ + 1592978400000, + "9648.21000000", + "9670.00000000", + "9642.42000000", + "9656.15000000", + "1347.29276000", + 1592981999999, + "13011659.39895175", + 15374, + "638.03840600", + "6162167.36180005", + "0" + ], + [ + 1592982000000, + "9656.09000000", + "9662.99000000", + "9500.00000000", + "9512.82000000", + "5415.11535500", + 1592985599999, + "51834130.35686915", + 47776, + "1960.52453100", + "18768764.52165583", + "0" + ], + [ + 1592985600000, + "9512.82000000", + "9550.00000000", + "9480.99000000", + "9518.78000000", + "3521.97943300", + 1592989199999, + "33539676.03760209", + 28839, + "1630.78081100", + "15532625.69334391", + "0" + ], + [ + 1592989200000, + "9518.82000000", + "9533.49000000", + "9490.00000000", + "9524.62000000", + "2134.76504100", + 1592992799999, + "20304874.09030011", + 18755, + "996.66571200", + "9480595.03707422", + "0" + ], + [ + 1592992800000, + "9524.65000000", + "9527.16000000", + "9313.00000000", + "9378.02000000", + "5959.91011900", + 1592996399999, + "56111090.02958314", + 51856, + "2272.93341700", + "21405927.17456031", + "0" + ], + [ + 1592996400000, + "9378.20000000", + "9415.71000000", + "9323.29000000", + "9331.32000000", + "4072.84363800", + 1592999999999, + "38157914.17131120", + 36255, + "1895.36983300", + "17760504.71282277", + "0" + ], + [ + 1593000000000, + "9331.32000000", + "9400.14000000", + "9280.00000000", + "9392.71000000", + "3688.60263000", + 1593003599999, + "34496493.99155020", + 33123, + "1540.35777500", + "14419140.69986247", + "0" + ], + [ + 1593003600000, + "9392.71000000", + "9430.00000000", + "9343.04000000", + "9350.31000000", + "2839.65574800", + 1593007199999, + "26688614.04538589", + 29902, + "1184.86386900", + "11138410.52463519", + "0" + ], + [ + 1593007200000, + "9351.14000000", + "9367.80000000", + "9291.66000000", + "9295.20000000", + "3687.08948900", + 1593010799999, + "34406145.46641599", + 32454, + "1690.68696700", + "15780340.59740279", + "0" + ], + [ + 1593010800000, + "9295.20000000", + "9342.10000000", + "9208.00000000", + "9249.93000000", + "7462.16430600", + 1593014399999, + "69224113.06130080", + 54284, + "3070.03138200", + "28486536.95513375", + "0" + ], + [ + 1593014400000, + "9249.97000000", + "9318.97000000", + "9238.96000000", + "9303.52000000", + "3500.92967400", + 1593017999999, + "32510761.45996663", + 32006, + "1938.19906000", + "17997328.22857894", + "0" + ], + [ + 1593018000000, + "9303.53000000", + "9324.01000000", + "9280.00000000", + "9306.53000000", + "1754.60024100", + 1593021599999, + "16321461.16726610", + 17332, + "771.56746800", + "7177450.11282500", + "0" + ], + [ + 1593021600000, + "9306.54000000", + "9334.51000000", + "9291.13000000", + "9309.34000000", + "1573.92662000", + 1593025199999, + "14664177.79356077", + 17076, + "777.34788700", + "7242671.22082348", + "0" + ], + [ + 1593025200000, + "9309.04000000", + "9343.02000000", + "9291.13000000", + "9299.00000000", + "1572.27744100", + 1593028799999, + "14653505.88747869", + 15938, + "621.12044000", + "5789363.00441178", + "0" + ], + [ + 1593028800000, + "9299.00000000", + "9321.97000000", + "9283.69000000", + "9299.72000000", + "1208.55579000", + 1593032399999, + "11246749.04865882", + 13547, + "571.65536700", + "5320144.61095578", + "0" + ], + [ + 1593032400000, + "9299.79000000", + "9306.42000000", + "9233.35000000", + "9273.50000000", + "1992.07997500", + 1593035999999, + "18463403.40036125", + 21929, + "801.77578600", + "7432390.96972374", + "0" + ], + [ + 1593036000000, + "9272.61000000", + "9297.91000000", + "9262.07000000", + "9297.79000000", + "1233.36445300", + 1593039599999, + "11448451.72024378", + 14390, + "634.32379500", + "5888648.33589846", + "0" + ], + [ + 1593039600000, + "9297.91000000", + "9328.46000000", + "9277.10000000", + "9296.49000000", + "1942.99732300", + 1593043199999, + "18073773.66730865", + 16862, + "982.43503900", + "9138474.33554805", + "0" + ], + [ + 1593043200000, + "9298.33000000", + "9298.33000000", + "9238.55000000", + "9270.22000000", + "1857.72034900", + 1593046799999, + "17231307.84512619", + 18292, + "872.25001800", + "8090158.95829412", + "0" + ], + [ + 1593046800000, + "9270.45000000", + "9306.82000000", + "9270.18000000", + "9276.50000000", + "1025.99805500", + 1593050399999, + "9529992.02328000", + 12357, + "513.29699000", + "4768307.25106205", + "0" + ], + [ + 1593050400000, + "9276.86000000", + "9285.49000000", + "9224.00000000", + "9255.01000000", + "2009.95203400", + 1593053999999, + "18606015.55893050", + 17925, + "892.06308900", + "8258915.02361832", + "0" + ], + [ + 1593054000000, + "9255.01000000", + "9257.00000000", + "9009.69000000", + "9100.36000000", + "10100.27355400", + 1593057599999, + "92063523.52760771", + 80497, + "3821.80948100", + "34830157.50022815", + "0" + ], + [ + 1593057600000, + "9100.13000000", + "9158.52000000", + "9090.17000000", + "9112.17000000", + "4475.28593500", + 1593061199999, + "40809561.57989155", + 28466, + "2553.53668000", + "23276903.55439400", + "0" + ], + [ + 1593061200000, + "9112.98000000", + "9196.92000000", + "9097.83000000", + "9179.35000000", + "2557.48403400", + 1593064799999, + "23423655.44220578", + 24612, + "1155.89093700", + "10585148.94017085", + "0" + ], + [ + 1593064800000, + "9179.35000000", + "9198.00000000", + "9164.14000000", + "9185.45000000", + "1573.97306800", + 1593068399999, + "14455395.25355565", + 17506, + "765.69541400", + "7032323.55514361", + "0" + ], + [ + 1593068400000, + "9185.46000000", + "9189.56000000", + "9141.77000000", + "9173.48000000", + "1393.65201800", + 1593071999999, + "12776533.63299090", + 13884, + "623.85318400", + "5719903.12842985", + "0" + ], + [ + 1593072000000, + "9173.70000000", + "9332.94000000", + "9173.55000000", + "9301.14000000", + "4405.36518000", + 1593075599999, + "40855328.41342900", + 38068, + "2396.44631200", + "22218221.13971932", + "0" + ], + [ + 1593075600000, + "9301.14000000", + "9315.67000000", + "9244.15000000", + "9254.47000000", + "2358.40734700", + 1593079199999, + "21888442.85197788", + 19118, + "1071.18791900", + "9942872.46541374", + "0" + ], + [ + 1593079200000, + "9254.47000000", + "9283.00000000", + "9246.58000000", + "9268.63000000", + "1586.54748000", + 1593082799999, + "14702196.99406084", + 17257, + "781.15850800", + "7238465.24285063", + "0" + ], + [ + 1593082800000, + "9268.34000000", + "9295.90000000", + "9254.99000000", + "9255.49000000", + "1210.86300000", + 1593086399999, + "11228122.68780309", + 15898, + "649.22288800", + "6019901.48396915", + "0" + ], + [ + 1593086400000, + "9255.79000000", + "9265.90000000", + "9160.03000000", + "9185.82000000", + "3073.27383500", + 1593089999999, + "28284595.67191243", + 31072, + "1448.10789800", + "13327050.75697415", + "0" + ], + [ + 1593090000000, + "9185.81000000", + "9242.47000000", + "9170.07000000", + "9194.46000000", + "1990.37078300", + 1593093599999, + "18336380.50210354", + 21143, + "952.01307400", + "8770694.60544939", + "0" + ], + [ + 1593093600000, + "9194.45000000", + "9269.70000000", + "9193.37000000", + "9251.02000000", + "2071.61417100", + 1593097199999, + "19147766.91351087", + 22325, + "1128.96499000", + "10434919.66285470", + "0" + ], + [ + 1593097200000, + "9251.01000000", + "9252.40000000", + "9216.34000000", + "9236.77000000", + "1582.81620900", + 1593100799999, + "14615078.50482992", + 18662, + "749.69339400", + "6922392.56347593", + "0" + ], + [ + 1593100800000, + "9236.88000000", + "9294.98000000", + "9212.00000000", + "9289.48000000", + "2097.15816200", + 1593104399999, + "19419305.23651703", + 22175, + "1113.28377300", + "10308617.63622855", + "0" + ], + [ + 1593104400000, + "9289.47000000", + "9296.69000000", + "9265.80000000", + "9283.20000000", + "1264.24526400", + 1593107999999, + "11733320.68094334", + 16990, + "593.64219000", + "5509766.96299155", + "0" + ], + [ + 1593108000000, + "9283.20000000", + "9291.46000000", + "9247.63000000", + "9251.98000000", + "1232.45710200", + 1593111599999, + "11420264.15556683", + 15641, + "576.61773000", + "5343117.14335822", + "0" + ], + [ + 1593111600000, + "9251.98000000", + "9295.00000000", + "9234.52000000", + "9287.06000000", + "1325.32760800", + 1593115199999, + "12297663.73317358", + 15631, + "618.87630000", + "5742907.35724890", + "0" + ], + [ + 1593115200000, + "9286.39000000", + "9301.10000000", + "9272.34000000", + "9275.00000000", + "1181.19000000", + 1593118799999, + "10968232.81633029", + 13378, + "596.72897400", + "5541813.47148008", + "0" + ], + [ + 1593118800000, + "9274.99000000", + "9340.00000000", + "9273.57000000", + "9304.59000000", + "1640.59894000", + 1593122399999, + "15275799.71809245", + 20067, + "821.28069800", + "7648020.32260385", + "0" + ], + [ + 1593122400000, + "9304.59000000", + "9316.75000000", + "9215.00000000", + "9261.51000000", + "3076.41897300", + 1593125999999, + "28475191.60096150", + 24308, + "1454.59223600", + "13462649.22552202", + "0" + ], + [ + 1593126000000, + "9261.53000000", + "9265.00000000", + "9236.97000000", + "9249.49000000", + "740.62605500", + 1593129599999, + "6853072.05998189", + 10933, + "396.18288600", + "3665905.93354246", + "0" + ], + [ + 1593129600000, + "9249.49000000", + "9290.01000000", + "9182.50000000", + "9282.99000000", + "2691.64638200", + 1593133199999, + "24874313.37635878", + 24274, + "1338.25608500", + "12369532.50613739", + "0" + ], + [ + 1593133200000, + "9282.76000000", + "9298.00000000", + "9251.84000000", + "9257.06000000", + "1133.69790500", + 1593136799999, + "10513476.61714420", + 13355, + "435.78394700", + "4041279.73663673", + "0" + ], + [ + 1593136800000, + "9257.07000000", + "9264.99000000", + "9238.43000000", + "9262.84000000", + "1010.28040500", + 1593140399999, + "9346827.88989105", + 12159, + "382.40223300", + "3537998.87886035", + "0" + ], + [ + 1593140400000, + "9262.57000000", + "9262.57000000", + "9232.98000000", + "9246.83000000", + "925.01261800", + 1593143999999, + "8550090.85388810", + 11575, + "473.73237700", + "4378428.20087992", + "0" + ], + [ + 1593144000000, + "9246.03000000", + "9270.00000000", + "9230.00000000", + "9257.50000000", + "970.37892000", + 1593147599999, + "8972345.58751221", + 15337, + "471.39605400", + "4359210.24571111", + "0" + ], + [ + 1593147600000, + "9257.49000000", + "9272.12000000", + "9202.47000000", + "9221.76000000", + "1700.59181800", + 1593151199999, + "15698732.90046968", + 21811, + "771.60828700", + "7122847.92653931", + "0" + ], + [ + 1593151200000, + "9221.76000000", + "9235.14000000", + "9193.40000000", + "9211.74000000", + "1312.20284600", + 1593154799999, + "12094731.69189982", + 15428, + "577.36038800", + "5322744.82117035", + "0" + ], + [ + 1593154800000, + "9211.74000000", + "9211.76000000", + "9100.18000000", + "9146.09000000", + "5607.38674300", + 1593158399999, + "51287460.16678923", + 49756, + "2570.80242200", + "23516144.09842491", + "0" + ], + [ + 1593158400000, + "9147.20000000", + "9167.33000000", + "9112.04000000", + "9135.33000000", + "2404.28792900", + 1593161999999, + "21976935.74934480", + 26711, + "1040.69621900", + "9514774.29833955", + "0" + ], + [ + 1593162000000, + "9134.93000000", + "9240.00000000", + "9091.55000000", + "9212.67000000", + "3979.79289000", + 1593165599999, + "36465603.48453427", + 36987, + "1946.67513200", + "17841535.76279960", + "0" + ], + [ + 1593165600000, + "9212.66000000", + "9256.75000000", + "9193.05000000", + "9217.27000000", + "2168.51231300", + 1593169199999, + "20003457.36714336", + 21972, + "1029.89347500", + "9503845.20652794", + "0" + ], + [ + 1593169200000, + "9217.27000000", + "9223.19000000", + "9151.91000000", + "9189.38000000", + "1758.01994400", + 1593172799999, + "16150056.25278079", + 22828, + "880.32902800", + "8087215.73594527", + "0" + ], + [ + 1593172800000, + "9189.38000000", + "9220.00000000", + "9183.50000000", + "9207.99000000", + "2019.07725900", + 1593176399999, + "18581250.65621542", + 22335, + "1012.02277700", + "9312671.73754291", + "0" + ], + [ + 1593176400000, + "9207.99000000", + "9232.50000000", + "9141.00000000", + "9151.78000000", + "1940.81292700", + 1593179999999, + "17837382.44794695", + 20912, + "878.32350800", + "8075120.88674396", + "0" + ], + [ + 1593180000000, + "9151.80000000", + "9157.10000000", + "9045.45000000", + "9089.25000000", + "5743.83378000", + 1593183599999, + "52220640.51825451", + 50110, + "2333.41205100", + "21217591.42808238", + "0" + ], + [ + 1593183600000, + "9089.26000000", + "9210.00000000", + "9080.00000000", + "9152.01000000", + "3750.19289800", + 1593187199999, + "34343279.44828838", + 30935, + "1872.57661600", + "17149192.43863258", + "0" + ], + [ + 1593187200000, + "9152.16000000", + "9158.55000000", + "9091.00000000", + "9147.29000000", + "2248.30658200", + 1593190799999, + "20526642.82794831", + 22524, + "906.24039900", + "8273912.39059674", + "0" + ], + [ + 1593190800000, + "9147.28000000", + "9176.88000000", + "9142.10000000", + "9153.83000000", + "1350.92811200", + 1593194399999, + "12379216.62964939", + 14892, + "625.27335700", + "5729498.04547303", + "0" + ], + [ + 1593194400000, + "9153.84000000", + "9181.61000000", + "9137.33000000", + "9141.20000000", + "1283.84935400", + 1593197999999, + "11754525.86130338", + 14124, + "639.11695800", + "5851507.87852919", + "0" + ], + [ + 1593198000000, + "9141.11000000", + "9170.00000000", + "9130.69000000", + "9166.80000000", + "1558.08418600", + 1593201599999, + "14264274.55608152", + 13892, + "737.09033400", + "6748195.28427948", + "0" + ], + [ + 1593201600000, + "9166.81000000", + "9218.00000000", + "9166.81000000", + "9193.72000000", + "1971.84885100", + 1593205199999, + "18131497.02621600", + 17534, + "1108.37192500", + "10191199.78502833", + "0" + ], + [ + 1593205200000, + "9193.72000000", + "9215.00000000", + "9174.52000000", + "9176.75000000", + "875.37165400", + 1593208799999, + "8050401.97504636", + 11373, + "384.96500300", + "3540307.14858300", + "0" + ], + [ + 1593208800000, + "9176.75000000", + "9201.19000000", + "9160.09000000", + "9172.07000000", + "928.25463800", + 1593212399999, + "8526389.91287521", + 9864, + "490.28591300", + "4504110.78271667", + "0" + ], + [ + 1593212400000, + "9172.07000000", + "9178.79000000", + "9147.85000000", + "9162.21000000", + "959.92732300", + 1593215999999, + "8797531.03192136", + 10259, + "401.28898700", + "3677967.61445054", + "0" + ], + [ + 1593216000000, + "9162.21000000", + "9169.74000000", + "9116.80000000", + "9145.77000000", + "1605.73405800", + 1593219599999, + "14669562.67849032", + 17272, + "796.93595000", + "7280048.74881667", + "0" + ], + [ + 1593219600000, + "9146.60000000", + "9158.26000000", + "9105.00000000", + "9151.23000000", + "1083.26994600", + 1593223199999, + "9894940.85776889", + 13806, + "503.13251800", + "4596981.88051805", + "0" + ], + [ + 1593223200000, + "9151.24000000", + "9159.66000000", + "9120.51000000", + "9145.63000000", + "943.73449700", + 1593226799999, + "8620999.63090890", + 12114, + "430.62977300", + "3933890.59632081", + "0" + ], + [ + 1593226800000, + "9145.64000000", + "9187.15000000", + "9133.18000000", + "9160.25000000", + "876.99641100", + 1593230399999, + "8036139.18796655", + 14698, + "541.93374000", + "4966140.83634450", + "0" + ], + [ + 1593230400000, + "9160.25000000", + "9179.57000000", + "9134.48000000", + "9159.61000000", + "942.84348800", + 1593233999999, + "8631818.90153159", + 11852, + "460.95713200", + "4220764.37026750", + "0" + ], + [ + 1593234000000, + "9159.64000000", + "9175.00000000", + "9142.85000000", + "9169.96000000", + "638.36439400", + 1593237599999, + "5848578.90482619", + 9858, + "317.98068600", + "2912923.80217553", + "0" + ], + [ + 1593237600000, + "9169.96000000", + "9196.24000000", + "9150.26000000", + "9184.78000000", + "1084.33974100", + 1593241199999, + "9953232.22803425", + 14550, + "557.86781400", + "5120427.01425930", + "0" + ], + [ + 1593241200000, + "9184.96000000", + "9190.00000000", + "9162.03000000", + "9174.25000000", + "824.16109700", + 1593244799999, + "7561409.05782548", + 10613, + "363.07366700", + "3330816.41413102", + "0" + ], + [ + 1593244800000, + "9174.37000000", + "9196.00000000", + "9155.02000000", + "9168.96000000", + "959.08302300", + 1593248399999, + "8801886.98177357", + 11837, + "462.12161800", + "4241330.51726955", + "0" + ], + [ + 1593248400000, + "9168.95000000", + "9170.27000000", + "9120.00000000", + "9143.57000000", + "1473.28423500", + 1593251999999, + "13483721.90753031", + 14164, + "596.73881000", + "5462780.53121641", + "0" + ], + [ + 1593252000000, + "9143.56000000", + "9165.00000000", + "9136.19000000", + "9142.78000000", + "1206.51011300", + 1593255599999, + "11039183.61654092", + 16537, + "684.53198800", + "6263185.81673688", + "0" + ], + [ + 1593255600000, + "9142.78000000", + "9184.38000000", + "9128.07000000", + "9159.97000000", + "1540.14581500", + 1593259199999, + "14098364.62242018", + 15611, + "857.61584700", + "7851388.44943472", + "0" + ], + [ + 1593259200000, + "9159.97000000", + "9176.81000000", + "9145.56000000", + "9164.38000000", + "895.37776600", + 1593262799999, + "8202454.69523894", + 12989, + "403.66043500", + "3697635.58597610", + "0" + ], + [ + 1593262800000, + "9164.38000000", + "9178.16000000", + "9145.00000000", + "9157.49000000", + "1114.20004600", + 1593266399999, + "10210253.18126325", + 13950, + "528.70250600", + "4846065.34665150", + "0" + ], + [ + 1593266400000, + "9157.50000000", + "9165.08000000", + "9128.44000000", + "9147.99000000", + "1136.70503700", + 1593269999999, + "10402138.26072384", + 16407, + "583.79371300", + "5342820.26368943", + "0" + ], + [ + 1593270000000, + "9148.00000000", + "9168.48000000", + "9113.00000000", + "9130.76000000", + "1656.79503600", + 1593273599999, + "15146781.92615315", + 19388, + "740.85979400", + "6773821.45739979", + "0" + ], + [ + 1593273600000, + "9130.82000000", + "9139.98000000", + "9066.66000000", + "9101.41000000", + "3917.66329700", + 1593277199999, + "35634073.35273299", + 37063, + "1694.24212600", + "15410322.42177221", + "0" + ], + [ + 1593277200000, + "9101.11000000", + "9149.49000000", + "9055.00000000", + "9080.29000000", + "2593.90186700", + 1593280799999, + "23594908.68497271", + 23320, + "1170.16550800", + "10646677.57915110", + "0" + ], + [ + 1593280800000, + "9080.30000000", + "9108.00000000", + "9059.68000000", + "9087.77000000", + "1407.36704000", + 1593284399999, + "12791246.48007651", + 18075, + "643.42230300", + "5849082.21537541", + "0" + ], + [ + 1593284400000, + "9087.76000000", + "9102.74000000", + "8833.00000000", + "8938.04000000", + "8584.09719100", + 1593287999999, + "76886882.17201994", + 72419, + "3061.55547000", + "27426027.20452449", + "0" + ], + [ + 1593288000000, + "8937.45000000", + "8994.70000000", + "8900.22000000", + "8953.14000000", + "5294.98366700", + 1593291599999, + "47445122.43541988", + 44521, + "2346.91587400", + "21028184.33804608", + "0" + ], + [ + 1593291600000, + "8953.20000000", + "9099.00000000", + "8945.17000000", + "9062.99000000", + "2204.11971300", + 1593295199999, + "19839643.07369628", + 31539, + "1253.80979500", + "11284414.25032337", + "0" + ], + [ + 1593295200000, + "9060.83000000", + "9078.07000000", + "8961.64000000", + "8972.99000000", + "2613.22714200", + 1593298799999, + "23564681.80825392", + 28160, + "1297.73878400", + "11699524.75126366", + "0" + ], + [ + 1593298800000, + "8973.47000000", + "9046.70000000", + "8940.15000000", + "9012.00000000", + "1694.02549300", + 1593302399999, + "15248777.59103282", + 18672, + "758.49100900", + "6828525.86921166", + "0" + ], + [ + 1593302400000, + "9012.00000000", + "9015.00000000", + "8956.06000000", + "8982.51000000", + "1523.66884300", + 1593305999999, + "13687225.71950179", + 18160, + "793.95092800", + "7131054.54930068", + "0" + ], + [ + 1593306000000, + "8982.51000000", + "8993.11000000", + "8948.06000000", + "8971.80000000", + "1222.48457600", + 1593309599999, + "10964814.12190425", + 14748, + "565.39532900", + "5071626.48483206", + "0" + ], + [ + 1593320400000, + "8971.86000000", + "8978.91000000", + "8961.21000000", + "8961.59000000", + "587.23589100", + 1593323999999, + "5267909.63259498", + 7442, + "258.76480200", + "2321781.59542967", + "0" + ], + [ + 1593324000000, + "8961.59000000", + "9024.20000000", + "8961.28000000", + "9019.81000000", + "1407.26000100", + 1593327599999, + "12663123.74501628", + 19105, + "620.70868300", + "5584534.82580255", + "0" + ], + [ + 1593327600000, + "9019.17000000", + "9034.65000000", + "8990.97000000", + "9023.09000000", + "1234.84791800", + 1593331199999, + "11126785.83193929", + 13779, + "553.08415700", + "4985029.26490547", + "0" + ], + [ + 1593331200000, + "9023.42000000", + "9082.00000000", + "9003.09000000", + "9054.21000000", + "2008.42703000", + 1593334799999, + "18153747.38004727", + 19018, + "1047.39879300", + "9470321.55504408", + "0" + ], + [ + 1593334800000, + "9054.20000000", + "9079.00000000", + "9041.53000000", + "9075.01000000", + "1716.59539000", + 1593338399999, + "15557178.78503843", + 19238, + "774.58798100", + "7019242.57435267", + "0" + ], + [ + 1593338400000, + "9075.09000000", + "9083.57000000", + "9051.00000000", + "9051.19000000", + "1133.26470100", + 1593341999999, + "10274300.25936332", + 15660, + "521.48839600", + "4727762.12321545", + "0" + ], + [ + 1593342000000, + "9052.06000000", + "9080.18000000", + "9037.23000000", + "9052.81000000", + "1326.29278200", + 1593345599999, + "12019763.13276126", + 17565, + "590.73795600", + "5354485.58901395", + "0" + ], + [ + 1593345600000, + "9052.80000000", + "9067.39000000", + "9020.44000000", + "9049.99000000", + "1467.32383500", + 1593349199999, + "13266159.32244289", + 18366, + "683.50061900", + "6179580.80911234", + "0" + ], + [ + 1593349200000, + "9050.00000000", + "9060.41000000", + "9037.99000000", + "9053.98000000", + "1028.37401600", + 1593352799999, + "9306664.59173755", + 13686, + "561.53236300", + "5082121.54730375", + "0" + ], + [ + 1593352800000, + "9053.97000000", + "9179.05000000", + "9053.07000000", + "9154.00000000", + "4185.03634800", + 1593356399999, + "38217081.36496157", + 36530, + "2298.93042600", + "20984466.31132197", + "0" + ], + [ + 1593356400000, + "9154.00000000", + "9164.49000000", + "9130.83000000", + "9159.42000000", + "1789.74978000", + 1593359999999, + "16370437.16227338", + 20967, + "835.75359300", + "7644844.40396703", + "0" + ], + [ + 1593360000000, + "9159.27000000", + "9191.00000000", + "9139.09000000", + "9147.72000000", + "1843.48639500", + 1593363599999, + "16898652.22102016", + 23867, + "971.62399200", + "8908747.71683849", + "0" + ], + [ + 1593363600000, + "9147.71000000", + "9159.47000000", + "9118.01000000", + "9155.85000000", + "1351.65401100", + 1593367199999, + "12354345.76636080", + 18594, + "561.89028100", + "5136780.72260666", + "0" + ], + [ + 1593367200000, + "9155.85000000", + "9168.98000000", + "9145.83000000", + "9153.50000000", + "738.67290500", + 1593370799999, + "6763896.73534943", + 11559, + "353.44690800", + "3236649.68783374", + "0" + ], + [ + 1593370800000, + "9153.63000000", + "9170.00000000", + "9102.50000000", + "9112.64000000", + "1405.51196700", + 1593374399999, + "12848516.01100655", + 18475, + "575.37537200", + "5260701.46240058", + "0" + ], + [ + 1593374400000, + "9112.12000000", + "9146.00000000", + "9090.00000000", + "9114.26000000", + "1242.18637600", + 1593377999999, + "11328825.62502903", + 21742, + "632.60451300", + "5769461.58494261", + "0" + ], + [ + 1593378000000, + "9114.27000000", + "9132.85000000", + "9093.87000000", + "9128.63000000", + "743.68704400", + 1593381599999, + "6776615.18565167", + 15767, + "353.96401200", + "3225282.69550789", + "0" + ], + [ + 1593381600000, + "9128.77000000", + "9134.56000000", + "9075.94000000", + "9104.40000000", + "1278.30912100", + 1593385199999, + "11627340.26083245", + 15133, + "593.81204900", + "5399815.28490101", + "0" + ], + [ + 1593385200000, + "9104.40000000", + "9133.01000000", + "9088.15000000", + "9116.35000000", + "1454.10749100", + 1593388799999, + "13248292.06727887", + 15003, + "834.25337500", + "7599325.03043274", + "0" + ], + [ + 1593388800000, + "9116.16000000", + "9136.66000000", + "9095.26000000", + "9123.85000000", + "981.61737400", + 1593392399999, + "8947408.69356987", + 14663, + "406.84849500", + "3708200.22344529", + "0" + ], + [ + 1593392400000, + "9123.85000000", + "9145.00000000", + "9115.37000000", + "9144.41000000", + "1224.09970700", + 1593395999999, + "11177456.06486907", + 16454, + "613.48703000", + "5602378.53841146", + "0" + ], + [ + 1593396000000, + "9144.41000000", + "9148.61000000", + "9122.59000000", + "9128.49000000", + "994.11374500", + 1593399599999, + "9079343.19614135", + 13834, + "409.32383400", + "3738587.58807423", + "0" + ], + [ + 1593399600000, + "9128.31000000", + "9128.31000000", + "9083.52000000", + "9097.01000000", + "1113.03743800", + 1593403199999, + "10137257.90420395", + 14178, + "426.27839900", + "3882164.15481169", + "0" + ], + [ + 1593403200000, + "9097.01000000", + "9124.12000000", + "9087.24000000", + "9113.98000000", + "951.72348000", + 1593406799999, + "8666016.16684455", + 13953, + "539.98196800", + "4917102.49010234", + "0" + ], + [ + 1593406800000, + "9113.97000000", + "9134.24000000", + "9098.72000000", + "9114.00000000", + "1280.23120600", + 1593410399999, + "11672288.03379946", + 14186, + "563.25354600", + "5136421.28714125", + "0" + ], + [ + 1593410400000, + "9113.97000000", + "9115.00000000", + "9079.09000000", + "9087.49000000", + "1446.22744700", + 1593413999999, + "13157179.97149137", + 16812, + "641.46831600", + "5835215.87471182", + "0" + ], + [ + 1593414000000, + "9087.48000000", + "9112.42000000", + "9062.39000000", + "9096.95000000", + "2442.67354600", + 1593417599999, + "22201712.76571638", + 21664, + "1444.58443500", + "13129517.36900657", + "0" + ], + [ + 1593417600000, + "9096.91000000", + "9097.03000000", + "9061.26000000", + "9094.71000000", + "1958.90383300", + 1593421199999, + "17788323.11198473", + 17368, + "898.55657900", + "8159309.98949928", + "0" + ], + [ + 1593421200000, + "9094.64000000", + "9142.00000000", + "9082.12000000", + "9134.93000000", + "1989.83840400", + 1593424799999, + "18128944.44297747", + 21578, + "891.08772600", + "8119051.39333348", + "0" + ], + [ + 1593424800000, + "9134.92000000", + "9139.79000000", + "9102.42000000", + "9115.78000000", + "1448.46751200", + 1593428399999, + "13208542.76743804", + 16773, + "541.15729300", + "4934670.44785780", + "0" + ], + [ + 1593428400000, + "9115.78000000", + "9115.78000000", + "9071.35000000", + "9097.38000000", + "2299.09578200", + 1593431999999, + "20897806.07768647", + 20093, + "1112.79633200", + "10115054.69142372", + "0" + ], + [ + 1593432000000, + "9097.37000000", + "9125.03000000", + "9080.87000000", + "9103.10000000", + "1757.89207900", + 1593435599999, + "16001402.39240534", + 22590, + "848.80820700", + "7727081.90754856", + "0" + ], + [ + 1593435600000, + "9103.13000000", + "9103.90000000", + "9024.67000000", + "9048.62000000", + "3196.02704800", + 1593439199999, + "28928529.35789690", + 29552, + "1391.23227600", + "12593456.80951234", + "0" + ], + [ + 1593439200000, + "9049.08000000", + "9093.78000000", + "9045.76000000", + "9065.17000000", + "1854.86558500", + 1593442799999, + "16820129.84556436", + 20712, + "961.51246600", + "8718358.35064460", + "0" + ], + [ + 1593442800000, + "9065.17000000", + "9135.36000000", + "9064.48000000", + "9124.75000000", + "2425.51289800", + 1593446399999, + "22075481.07064647", + 22604, + "1363.64420900", + "12411063.86717897", + "0" + ], + [ + 1593446400000, + "9124.43000000", + "9160.00000000", + "9102.03000000", + "9122.05000000", + "2199.48516400", + 1593449999999, + "20076228.43395869", + 20491, + "1089.22668000", + "9943666.29544930", + "0" + ], + [ + 1593450000000, + "9123.09000000", + "9164.69000000", + "9109.31000000", + "9160.14000000", + "2136.49486900", + 1593453599999, + "19526967.39631363", + 18228, + "1135.60172400", + "10379830.47304905", + "0" + ], + [ + 1593453600000, + "9160.14000000", + "9180.00000000", + "9135.10000000", + "9142.17000000", + "1603.76778900", + 1593457199999, + "14682331.03792720", + 14812, + "835.01685100", + "7646086.12941361", + "0" + ], + [ + 1593457200000, + "9142.83000000", + "9160.27000000", + "9130.73000000", + "9158.10000000", + "1165.10362200", + 1593460799999, + "10656556.65934362", + 11855, + "618.37662500", + "5656651.95938358", + "0" + ], + [ + 1593460800000, + "9158.10000000", + "9196.66000000", + "9146.91000000", + "9184.97000000", + "2059.68646500", + 1593464399999, + "18894503.92710027", + 16847, + "991.49637000", + "9094393.80778533", + "0" + ], + [ + 1593464400000, + "9184.97000000", + "9236.00000000", + "9184.17000000", + "9210.47000000", + "2451.68305100", + 1593467999999, + "22593317.30096556", + 23345, + "1331.68030500", + "12270270.08559121", + "0" + ], + [ + 1593468000000, + "9210.46000000", + "9238.00000000", + "9177.41000000", + "9184.21000000", + "1913.17237600", + 1593471599999, + "17622907.97502752", + 18921, + "857.64173800", + "7900983.47451493", + "0" + ], + [ + 1593471600000, + "9184.22000000", + "9197.79000000", + "9161.09000000", + "9192.56000000", + "1226.57284100", + 1593475199999, + "11265691.87680813", + 12786, + "536.03639200", + "4923350.20267167", + "0" + ], + [ + 1593475200000, + "9192.93000000", + "9203.82000000", + "9166.08000000", + "9174.53000000", + "1145.65669300", + 1593478799999, + "10519744.96733216", + 12063, + "638.03764600", + "5858427.43472756", + "0" + ], + [ + 1593478800000, + "9174.67000000", + "9205.00000000", + "9155.06000000", + "9199.48000000", + "1397.91436700", + 1593482399999, + "12830444.37720744", + 12632, + "744.18617800", + "6831601.16234379", + "0" + ], + [ + 1593482400000, + "9199.39000000", + "9199.99000000", + "9171.71000000", + "9180.83000000", + "795.35152000", + 1593485999999, + "7301996.21374810", + 9436, + "431.58976500", + "3962503.81312625", + "0" + ], + [ + 1593486000000, + "9180.84000000", + "9183.01000000", + "9160.23000000", + "9161.65000000", + "669.87153800", + 1593489599999, + "6143507.34208659", + 8018, + "268.81423400", + "2465532.25370438", + "0" + ], + [ + 1593489600000, + "9161.67000000", + "9178.87000000", + "9149.68000000", + "9157.02000000", + "829.90981700", + 1593493199999, + "7607258.16461081", + 8948, + "363.64476300", + "3333645.94320571", + "0" + ], + [ + 1593493200000, + "9157.02000000", + "9165.29000000", + "9116.92000000", + "9128.00000000", + "1912.41300300", + 1593496799999, + "17485413.73651682", + 17106, + "960.32703700", + "8779344.72690369", + "0" + ], + [ + 1593496800000, + "9128.00000000", + "9155.09000000", + "9111.94000000", + "9149.75000000", + "1629.59370400", + 1593500399999, + "14891310.11315635", + 15620, + "765.43362600", + "6993859.58610128", + "0" + ], + [ + 1593500400000, + "9149.75000000", + "9159.74000000", + "9130.67000000", + "9144.88000000", + "1131.91584000", + 1593503999999, + "10346283.82314100", + 12429, + "462.62861900", + "4228778.17340456", + "0" + ], + [ + 1593504000000, + "9144.34000000", + "9145.99000000", + "9113.55000000", + "9134.33000000", + "1176.97961000", + 1593507599999, + "10749705.54776089", + 13479, + "570.79388800", + "5213590.33292725", + "0" + ], + [ + 1593507600000, + "9134.22000000", + "9174.00000000", + "9131.38000000", + "9153.31000000", + "1445.81385700", + 1593511199999, + "13235347.36414065", + 15480, + "706.74383100", + "6469782.77655499", + "0" + ], + [ + 1593511200000, + "9153.31000000", + "9171.58000000", + "9144.14000000", + "9151.88000000", + "1133.58458700", + 1593514799999, + "10378792.78022772", + 13209, + "572.51658700", + "5241865.45870810", + "0" + ], + [ + 1593514800000, + "9152.14000000", + "9161.35000000", + "9132.06000000", + "9148.90000000", + "1137.91465500", + 1593518399999, + "10407596.21412836", + 12522, + "534.91931300", + "4892734.56834632", + "0" + ], + [ + 1593518400000, + "9148.89000000", + "9148.89000000", + "9112.00000000", + "9121.77000000", + "1551.13036800", + 1593521999999, + "14158826.68840696", + 16712, + "672.83513400", + "6142117.43920429", + "0" + ], + [ + 1593522000000, + "9121.77000000", + "9156.63000000", + "9064.89000000", + "9131.10000000", + "4052.70572700", + 1593525599999, + "36904174.38426575", + 32092, + "1869.89062000", + "17035862.28666643", + "0" + ], + [ + 1593525600000, + "9131.10000000", + "9183.01000000", + "9125.67000000", + "9181.21000000", + "1845.00724000", + 1593529199999, + "16895311.98967761", + 18506, + "1038.69687100", + "9511909.07452114", + "0" + ], + [ + 1593529200000, + "9181.21000000", + "9189.00000000", + "9157.88000000", + "9169.57000000", + "1720.92478900", + 1593532799999, + "15788718.62622840", + 19261, + "920.90154000", + "8449003.09099050", + "0" + ], + [ + 1593532800000, + "9169.99000000", + "9179.29000000", + "9153.16000000", + "9174.71000000", + "1111.11210600", + 1593536399999, + "10185243.69802863", + 15495, + "560.28450600", + "5135942.92242490", + "0" + ], + [ + 1593536400000, + "9174.84000000", + "9177.11000000", + "9122.67000000", + "9147.48000000", + "1310.85849800", + 1593539999999, + "11992227.85386849", + 14156, + "568.24169800", + "5198339.54591586", + "0" + ], + [ + 1593540000000, + "9147.48000000", + "9153.68000000", + "9126.58000000", + "9131.11000000", + "871.16615300", + 1593543599999, + "7963610.96600660", + 9562, + "402.89585700", + "3683562.59956434", + "0" + ], + [ + 1593543600000, + "9131.11000000", + "9154.29000000", + "9095.12000000", + "9134.73000000", + "1409.19830400", + 1593547199999, + "12865919.13025144", + 13799, + "684.82314300", + "6252694.32757703", + "0" + ], + [ + 1593547200000, + "9134.29000000", + "9158.91000000", + "9130.00000000", + "9151.52000000", + "792.69440100", + 1593550799999, + "7251560.70783157", + 9339, + "373.56950400", + "3417906.80061854", + "0" + ], + [ + 1593550800000, + "9151.53000000", + "9172.44000000", + "9149.41000000", + "9160.19000000", + "732.69568400", + 1593554399999, + "6711225.39670957", + 9389, + "391.68410200", + "3587683.08718765", + "0" + ], + [ + 1593554400000, + "9160.18000000", + "9163.39000000", + "9125.00000000", + "9134.01000000", + "827.25430300", + 1593557999999, + "7561818.81960048", + 10033, + "360.97683400", + "3299327.12374531", + "0" + ], + [ + 1593558000000, + "9134.01000000", + "9158.87000000", + "9129.39000000", + "9138.55000000", + "831.49603700", + 1593561599999, + "7605295.61208340", + 8797, + "403.31217100", + "3688636.57429647", + "0" + ], + [ + 1593561600000, + "9138.08000000", + "9138.16000000", + "9080.10000000", + "9122.00000000", + "1737.64189900", + 1593565199999, + "15831394.79607631", + 17535, + "752.80150200", + "6859354.46405732", + "0" + ], + [ + 1593565200000, + "9121.99000000", + "9131.73000000", + "9101.00000000", + "9125.00000000", + "792.51124600", + 1593568799999, + "7226390.16058554", + 10046, + "363.72968800", + "3316752.73073886", + "0" + ], + [ + 1593568800000, + "9125.00000000", + "9146.67000000", + "9112.87000000", + "9135.11000000", + "1075.67886700", + 1593572399999, + "9827405.94491953", + 12986, + "562.69583400", + "5140847.20859687", + "0" + ], + [ + 1593572400000, + "9135.10000000", + "9141.66000000", + "9113.11000000", + "9138.59000000", + "672.28175000", + 1593575999999, + "6137850.02029632", + 9955, + "315.32823800", + "2879169.61625270", + "0" + ] + ], + "queryString": "endTime=1593572400000\u0026interval=1h\u0026limit=1000\u0026startTime=1591880400000\u0026symbol=BTCUSDT", + "bodyParams": "", + "headers": {} + }, + { + "data": [ + [ + 1598918400000, + "11649.51000000", + "12050.85000000", + "11515.00000000", + "11921.97000000", + "78148.19366800", + 1599004799999, + "928047313.48896665", + 1321492, + "37476.01938200", + "444996773.66832210", + "0" + ], + [ + 1599004800000, + "11921.97000000", + "11954.57000000", + "11160.10000000", + "11388.54000000", + "87221.84560200", + 1599091199999, + "1005391012.13387515", + 1373524, + "39972.30988700", + "460939443.22481512", + "0" + ], + [ + 1599091200000, + "11388.54000000", + "11462.60000000", + "9960.80000000", + "10140.85000000", + "121950.10601500", + 1599177599999, + "1325106403.31586748", + 1611610, + "54266.83286000", + "590230451.11230783", + "0" + ], + [ + 1599177600000, + "10138.29000000", + "10627.05000000", + "9875.50000000", + "10446.25000000", + "92733.59911300", + 1599263999999, + "959925718.35127546", + 1434860, + "42707.83466600", + "442163704.19721961", + "0" + ], + [ + 1599264000000, + "10446.25000000", + "10565.68000000", + "9825.00000000", + "10166.69000000", + "90001.60556800", + 1599350399999, + "917578408.87611822", + 1476782, + "43478.13232300", + "443342852.18707489", + "0" + ], + [ + 1599350400000, + "10166.69000000", + "10347.14000000", + "9994.86000000", + "10256.20000000", + "56368.78881500", + 1599436799999, + "574903000.23517457", + 1053192, + "28033.43882700", + "285904912.75096270", + "0" + ], + [ + 1599436800000, + "10255.89000000", + "10410.75000000", + "9875.00000000", + "10373.44000000", + "62620.23067600", + 1599523199999, + "634278537.81510948", + 927363, + "30576.70067300", + "309796338.54525116", + "0" + ], + [ + 1599523200000, + "10373.45000000", + "10438.00000000", + "9850.00000000", + "10126.65000000", + "73491.87841800", + 1599609599999, + "742947901.97123937", + 1048125, + "34410.81447000", + "348048428.88372554", + "0" + ], + [ + 1599609600000, + "10126.66000000", + "10343.00000000", + "9981.01000000", + "10219.20000000", + "49347.11377600", + 1599695999999, + "503082625.21479094", + 755560, + "23815.41242700", + "242759702.91500349", + "0" + ], + [ + 1599696000000, + "10219.29000000", + "10483.35000000", + "10070.83000000", + "10336.87000000", + "58253.75375000", + 1599782399999, + "602390078.49228073", + 851877, + "27690.11249800", + "286362452.83931564", + "0" + ], + [ + 1599782400000, + "10336.86000000", + "10397.60000000", + "10200.00000000", + "10387.89000000", + "43830.25446700", + 1599868799999, + "451241002.66033623", + 637869, + "21231.61072700", + "218592078.02890880", + "0" + ], + [ + 1599868800000, + "10387.89000000", + "10477.97000000", + "10269.25000000", + "10440.92000000", + "35379.15309600", + 1599955199999, + "366912671.44372690", + 577724, + "17560.76888500", + "182148657.45690611", + "0" + ], + [ + 1599955200000, + "10440.67000000", + "10580.11000000", + "10200.00000000", + "10332.83000000", + "43837.60986500", + 1600041599999, + "455338605.32914889", + 692439, + "20785.51732800", + "215965189.31612750", + "0" + ], + [ + 1600041600000, + "10332.84000000", + "10750.00000000", + "10212.34000000", + "10671.77000000", + "67059.29136100", + 1600127999999, + "706175591.38661278", + 828957, + "31880.36315700", + "335719021.03890433", + "0" + ], + [ + 1600128000000, + "10671.77000000", + "10930.04000000", + "10606.48000000", + "10785.31000000", + "61822.45278600", + 1600214399999, + "666457161.14913774", + 893852, + "29744.08727700", + "320640236.40587628", + "0" + ], + [ + 1600214400000, + "10785.23000000", + "11093.00000000", + "10661.22000000", + "10954.01000000", + "64991.51244000", + 1600300799999, + "708644989.48306988", + 884153, + "31740.51169100", + "346117690.57309232", + "0" + ], + [ + 1600300800000, + "10954.01000000", + "11045.46000000", + "10745.83000000", + "10939.99000000", + "55601.61452900", + 1600387199999, + "605010288.77992461", + 829137, + "27029.92703500", + "294147097.61187047", + "0" + ], + [ + 1600387200000, + "10940.00000000", + "11038.03000000", + "10812.84000000", + "10933.39000000", + "47266.72827500", + 1600473599999, + "516147935.66922837", + 717371, + "23044.91988600", + "251654627.23674528", + "0" + ], + [ + 1600473600000, + "10933.40000000", + "11179.79000000", + "10887.37000000", + "11080.65000000", + "38440.03685800", + 1600559999999, + "423651901.15773042", + 620127, + "19923.05926700", + "219623766.31297809", + "0" + ], + [ + 1600560000000, + "11080.64000000", + "11080.64000000", + "10723.00000000", + "10920.28000000", + "39157.92256500", + 1600646399999, + "426815210.75551225", + 646329, + "19437.69436300", + "211845335.51564800", + "0" + ], + [ + 1600646400000, + "10920.28000000", + "10988.86000000", + "10296.35000000", + "10417.22000000", + "70683.43117900", + 1600732799999, + "751020795.23588369", + 1028531, + "33628.93058900", + "357346575.16901842", + "0" + ], + [ + 1600732800000, + "10417.22000000", + "10572.71000000", + "10353.00000000", + "10529.61000000", + "43991.23547600", + 1600819199999, + "460362500.72840808", + 738576, + "21497.46158900", + "224981251.32868055", + "0" + ], + [ + 1600819200000, + "10529.61000000", + "10537.15000000", + "10136.82000000", + "10241.46000000", + "51876.56807900", + 1600905599999, + "539362015.15746196", + 774391, + "25012.70681900", + "260045385.65157037", + "0" + ], + [ + 1600905600000, + "10241.46000000", + "10795.24000000", + "10190.93000000", + "10736.32000000", + "57676.61942700", + 1600991999999, + "604520870.05563795", + 789282, + "27946.80432500", + "292936072.98704616", + "0" + ], + [ + 1600992000000, + "10736.33000000", + "10760.53000000", + "10556.24000000", + "10686.67000000", + "48101.11700800", + 1601078399999, + "512647249.14932008", + 733430, + "23566.33033700", + "251168863.92711731", + "0" + ], + [ + 1601078400000, + "10686.57000000", + "10820.94000000", + "10644.68000000", + "10728.60000000", + "28420.83665900", + 1601164799999, + "304511477.68085537", + 502670, + "14314.53134500", + "153391173.49799378", + "0" + ], + [ + 1601164800000, + "10728.59000000", + "10799.00000000", + "10594.82000000", + "10774.25000000", + "30549.48325300", + 1601251199999, + "327169249.45499568", + 516004, + "15101.03977000", + "161737536.90897186", + "0" + ], + [ + 1601251200000, + "10774.26000000", + "10950.00000000", + "10626.00000000", + "10696.12000000", + "50095.25173400", + 1601337599999, + "544463219.59780924", + 686664, + "25219.07331500", + "274111924.66132492", + "0" + ], + [ + 1601337600000, + "10696.11000000", + "10867.54000000", + "10635.87000000", + "10840.48000000", + "41874.89839900", + 1601423999999, + "449345822.46022889", + 587576, + "19896.07620900", + "213544159.85659414", + "0" + ], + [ + 1601424000000, + "10840.58000000", + "10849.34000000", + "10665.13000000", + "10776.59000000", + "39596.02732200", + 1601510399999, + "425279696.28526338", + 595383, + "18712.05971100", + "200976719.44085080", + "0" + ], + [ + 1601510400000, + "10776.59000000", + "10920.00000000", + "10437.00000000", + "10619.13000000", + "60866.33289300", + 1601596799999, + "652168989.46173484", + 794855, + "28449.97510300", + "304779535.38197477", + "0" + ], + [ + 1601596800000, + "10619.13000000", + "10664.64000000", + "10374.00000000", + "10570.40000000", + "50130.39370500", + 1601683199999, + "526864379.30936534", + 777193, + "24123.90254500", + "253507685.50358702", + "0" + ], + [ + 1601683200000, + "10570.40000000", + "10603.56000000", + "10496.46000000", + "10542.06000000", + "22298.22134100", + 1601769599999, + "235160884.60853616", + 381329, + "10752.46288200", + "113392722.76217199", + "0" + ], + [ + 1601769600000, + "10542.07000000", + "10696.87000000", + "10517.87000000", + "10666.63000000", + "23212.00159500", + 1601855999999, + "246252050.90681072", + 377553, + "12123.27565000", + "128619845.13152086", + "0" + ], + [ + 1601856000000, + "10666.62000000", + "10798.00000000", + "10615.64000000", + "10792.21000000", + "34025.76165300", + 1601942399999, + "364158510.23798056", + 483340, + "15551.58438700", + "166457546.86846151", + "0" + ], + [ + 1601942400000, + "10792.20000000", + "10800.00000000", + "10525.00000000", + "10599.66000000", + "48674.74047100", + 1602028799999, + "520051256.08219917", + 734526, + "23189.68990000", + "247740447.63670599", + "0" + ], + [ + 1602028800000, + "10599.65000000", + "10681.87000000", + "10546.17000000", + "10666.39000000", + "32811.99027900", + 1602115199999, + "348298562.85686264", + 503440, + "15783.35568400", + "167548410.82933536", + "0" + ], + [ + 1602115200000, + "10666.40000000", + "10950.00000000", + "10530.41000000", + "10925.57000000", + "51959.69157200", + 1602201599999, + "559311760.44148029", + 659291, + "26482.59952900", + "285240420.95776404", + "0" + ], + [ + 1602201600000, + "10925.44000000", + "11104.64000000", + "10829.00000000", + "11050.64000000", + "48240.07323700", + 1602287999999, + "530822321.51623468", + 635681, + "25658.63139600", + "282409996.00931151", + "0" + ], + [ + 1602288000000, + "11050.64000000", + "11491.00000000", + "11050.51000000", + "11293.22000000", + "43648.03694300", + 1602374399999, + "494785212.23087354", + 698561, + "22807.20465100", + "258432465.79040960", + "0" + ], + [ + 1602374400000, + "11293.22000000", + "11445.00000000", + "11221.00000000", + "11369.02000000", + "29043.85133900", + 1602460799999, + "329927755.03808506", + 509714, + "14470.44426900", + "164384653.13411286", + "0" + ], + [ + 1602460800000, + "11369.02000000", + "11720.01000000", + "11172.00000000", + "11528.25000000", + "52825.28371000", + 1602547199999, + "604779845.79201771", + 740823, + "26865.92932100", + "307665447.33923441", + "0" + ], + [ + 1602547200000, + "11528.24000000", + "11557.00000000", + "11300.00000000", + "11420.56000000", + "42205.28370900", + 1602633599999, + "482663390.72403579", + 618262, + "19346.15860500", + "221257357.56527471", + "0" + ], + [ + 1602633600000, + "11420.57000000", + "11547.98000000", + "11280.00000000", + "11417.89000000", + "41415.10601500", + 1602719999999, + "472007015.72093425", + 590025, + "19070.05730700", + "217375960.31094741", + "0" + ], + [ + 1602720000000, + "11417.89000000", + "11617.34000000", + "11250.83000000", + "11505.12000000", + "48760.71767900", + 1602806399999, + "556436445.55762819", + 662386, + "24019.23766900", + "274171016.90668138", + "0" + ], + [ + 1602806400000, + "11505.13000000", + "11541.15000000", + "11200.00000000", + "11319.32000000", + "48797.74950200", + 1602892799999, + "553211001.61225689", + 693210, + "22821.59348400", + "258752919.33224074", + "0" + ], + [ + 1602892800000, + "11319.24000000", + "11402.42000000", + "11255.00000000", + "11360.20000000", + "22368.91524100", + 1602979199999, + "253582775.96265448", + 365973, + "10318.02461400", + "116996094.14462668", + "0" + ], + [ + 1602979200000, + "11360.31000000", + "11505.00000000", + "11346.22000000", + "11503.14000000", + "23284.04119100", + 1603065599999, + "266150824.34809863", + 346946, + "12396.12709900", + "141743879.12841902", + "0" + ], + [ + 1603065600000, + "11503.14000000", + "11823.99000000", + "11407.96000000", + "11751.47000000", + "47414.53469200", + 1603151999999, + "550728683.79927939", + 650960, + "24716.39513600", + "287236347.54906069", + "0" + ], + [ + 1603152000000, + "11751.46000000", + "12038.38000000", + "11677.59000000", + "11909.99000000", + "62134.75066300", + 1603238399999, + "737425592.08197176", + 906111, + "31911.70883200", + "378905888.96006281", + "0" + ], + [ + 1603238400000, + "11910.00000000", + "13217.68000000", + "11886.95000000", + "12780.96000000", + "114584.45676700", + 1603324799999, + "1437122186.63399548", + 1453620, + "59033.67175600", + "740274649.28079579", + "0" + ], + [ + 1603324800000, + "12780.75000000", + "13185.00000000", + "12678.08000000", + "12968.52000000", + "70038.82414400", + 1603411199999, + "905778888.87029065", + 1035811, + "33259.49504400", + "430203750.01892518", + "0" + ], + [ + 1603411200000, + "12968.84000000", + "13027.69000000", + "12720.08000000", + "12923.07000000", + "50386.99984100", + 1603497599999, + "650680239.11014686", + 699313, + "24685.92549500", + "318827712.19820076", + "0" + ], + [ + 1603497600000, + "12923.06000000", + "13166.73000000", + "12870.00000000", + "13111.73000000", + "35952.20907000", + 1603583999999, + "468299521.76966531", + 536821, + "18382.74457900", + "239455378.09125662", + "0" + ], + [ + 1603584000000, + "13111.73000000", + "13350.00000000", + "12888.00000000", + "13028.83000000", + "38481.57950400", + 1603670399999, + "502672049.22905163", + 610498, + "17988.76710000", + "235115943.82713218", + "0" + ], + [ + 1603670400000, + "13029.64000000", + "13238.81000000", + "12765.00000000", + "13052.19000000", + "60951.67298600", + 1603756799999, + "794395722.45334551", + 818144, + "29609.99469800", + "385986654.65788211", + "0" + ], + [ + 1603756800000, + "13052.15000000", + "13789.29000000", + "13019.87000000", + "13636.17000000", + "80796.55399600", + 1603843199999, + "1085214437.75111358", + 1003550, + "39833.62658600", + "534892605.74526497", + "0" + ], + [ + 1603843200000, + "13636.16000000", + "13859.48000000", + "12888.00000000", + "13266.40000000", + "94440.56122600", + 1603929599999, + "1263487952.99515693", + 1234511, + "43387.69227500", + "580505216.87260939", + "0" + ], + [ + 1603929600000, + "13266.40000000", + "13642.91000000", + "12920.77000000", + "13455.70000000", + "74872.60213200", + 1604015999999, + "997867948.86097431", + 1008433, + "37203.24565800", + "495772429.35476798", + "0" + ], + [ + 1604016000000, + "13455.69000000", + "13669.98000000", + "13115.00000000", + "13560.10000000", + "70657.77888100", + 1604102399999, + "946818817.55750918", + 1060387, + "34438.58889000", + "461667557.39357111", + "0" + ], + [ + 1604102400000, + "13560.10000000", + "14100.00000000", + "13411.50000000", + "13791.00000000", + "67339.23851500", + 1604188799999, + "927048458.54236180", + 1022202, + "35823.22565000", + "493309455.83898129", + "0" + ], + [ + 1604188800000, + "13791.00000000", + "13895.00000000", + "13603.00000000", + "13761.50000000", + "36285.64852600", + 1604275199999, + "499124369.07532642", + 606248, + "17839.54476000", + "245432626.61531792", + "0" + ], + [ + 1604275200000, + "13761.49000000", + "13830.00000000", + "13195.05000000", + "13549.37000000", + "64566.42190800", + 1604361599999, + "873629993.83139279", + 869850, + "29243.23366400", + "395698601.61694086", + "0" + ], + [ + 1604361600000, + "13549.63000000", + "14066.11000000", + "13284.99000000", + "14023.53000000", + "74115.63078700", + 1604447999999, + "1009402087.71046155", + 1052569, + "38332.71333000", + "522431362.88788262", + "0" + ], + [ + 1604448000000, + "14023.53000000", + "14259.00000000", + "13525.00000000", + "14144.01000000", + "93016.98826200", + 1604534399999, + "1293872665.41796188", + 1212959, + "45333.66159600", + "630831907.07329258", + "0" + ], + [ + 1604534400000, + "14144.01000000", + "15750.00000000", + "14093.56000000", + "15590.02000000", + "143741.52267300", + 1604620799999, + "2131865609.29089107", + 1736055, + "72196.12711800", + "1071067716.59486903", + "0" + ], + [ + 1604620800000, + "15590.02000000", + "15960.00000000", + "15166.00000000", + "15579.92000000", + "122618.19769500", + 1604707199999, + "1909660728.82292043", + 1654968, + "58528.76053300", + "911733812.27929558", + "0" + ], + [ + 1604707200000, + "15579.93000000", + "15753.52000000", + "14344.22000000", + "14818.30000000", + "101431.20655300", + 1604793599999, + "1536510177.09147370", + 1557021, + "46204.87062100", + "700220031.30034720", + "0" + ], + [ + 1604793600000, + "14818.30000000", + "15650.00000000", + "14703.88000000", + "15475.10000000", + "65547.17857400", + 1604879999999, + "998031373.83978030", + 998773, + "31175.66089200", + "474978556.38937917", + "0" + ], + [ + 1604880000000, + "15475.10000000", + "15840.00000000", + "14805.54000000", + "15328.41000000", + "108976.33413400", + 1604966399999, + "1670447935.51417895", + 1505441, + "51350.44664100", + "787324390.76709841", + "0" + ], + [ + 1604966400000, + "15328.41000000", + "15460.00000000", + "15072.46000000", + "15297.21000000", + "61681.91960600", + 1605052799999, + "943615126.08915049", + 1093466, + "28945.76656700", + "442891690.01260021", + "0" + ], + [ + 1605052800000, + "15297.21000000", + "15965.00000000", + "15272.68000000", + "15684.24000000", + "78469.74645800", + 1605139199999, + "1226425496.36185528", + 1247167, + "40030.00217300", + "625865373.37834106", + "0" + ], + [ + 1605139200000, + "15684.25000000", + "16340.70000000", + "15440.64000000", + "16291.86000000", + "102196.35659200", + 1605225599999, + "1628755508.67419840", + 1472049, + "50444.97887400", + "804204066.43862830", + "0" + ], + [ + 1605225600000, + "16291.85000000", + "16480.00000000", + "15952.35000000", + "16320.70000000", + "75691.88101400", + 1605311999999, + "1230358611.12488923", + 1208773, + "35301.73094000", + "574048021.73652388", + "0" + ], + [ + 1605312000000, + "16320.04000000", + "16326.99000000", + "15670.00000000", + "16070.45000000", + "59116.34717900", + 1605398399999, + "944765868.60941899", + 931424, + "27724.76780100", + "443001467.22337944", + "0" + ], + [ + 1605398400000, + "16069.56000000", + "16180.00000000", + "15774.72000000", + "15957.00000000", + "43596.84151300", + 1605484799999, + "696651729.74525343", + 854441, + "20853.27084600", + "333239080.64181383", + "0" + ], + [ + 1605484800000, + "15957.00000000", + "16880.00000000", + "15864.00000000", + "16713.57000000", + "81300.67592400", + 1605571199999, + "1335728013.90576045", + 1202386, + "41370.21365900", + "679593360.64957386", + "0" + ], + [ + 1605571200000, + "16713.08000000", + "17858.82000000", + "16538.00000000", + "17659.38000000", + "115221.40310200", + 1605657599999, + "1982752071.45051193", + 1646652, + "58262.06259700", + "1003081009.61604291", + "0" + ], + [ + 1605657600000, + "17659.38000000", + "18476.93000000", + "17214.45000000", + "17776.12000000", + "149019.78813400", + 1605743999999, + "2663337935.50029849", + 2091832, + "73412.73627800", + "1312369471.65248184", + "0" + ], + [ + 1605744000000, + "17777.75000000", + "18179.80000000", + "17335.65000000", + "17802.82000000", + "93009.56100800", + 1605830399999, + "1656794228.85376354", + 1513304, + "45376.57785100", + "808306886.97419079", + "0" + ], + [ + 1605830400000, + "17802.81000000", + "18815.22000000", + "17740.04000000", + "18655.67000000", + "88423.01848900", + 1605916799999, + "1623135138.59107146", + 1444692, + "43549.51207000", + "799574963.80587161", + "0" + ], + [ + 1605916800000, + "18655.66000000", + "18965.90000000", + "18308.58000000", + "18703.80000000", + "75577.45839400", + 1606003199999, + "1413641591.28417115", + 1451352, + "36788.09469300", + "688352207.11315332", + "0" + ], + [ + 1606003200000, + "18703.80000000", + "18750.00000000", + "17610.86000000", + "18414.43000000", + "81645.73777800", + 1606089599999, + "1497662550.05404281", + 1528524, + "39164.42638000", + "718709271.13717676", + "0" + ], + [ + 1606089600000, + "18413.88000000", + "18766.00000000", + "18000.00000000", + "18368.00000000", + "82961.50609300", + 1606175999999, + "1529064319.66944352", + 1629379, + "39611.36061700", + "730350629.71705125", + "0" + ], + [ + 1606176000000, + "18368.01000000", + "19418.97000000", + "18018.00000000", + "19160.01000000", + "113581.50924100", + 1606262399999, + "2145301450.45794128", + 2179862, + "58179.20088200", + "1098976481.12570495", + "0" + ], + [ + 1606262400000, + "19160.00000000", + "19484.21000000", + "18500.27000000", + "18719.11000000", + "93266.57688700", + 1606348799999, + "1774870796.28823277", + 1785408, + "44575.07675800", + "848724583.33005267", + "0" + ], + [ + 1606348800000, + "18718.83000000", + "18915.03000000", + "16188.00000000", + "17149.47000000", + "181005.24669300", + 1606435199999, + "3127314143.10457491", + 2770483, + "84478.80913100", + "1459155975.95315027", + "0" + ], + [ + 1606435200000, + "17149.47000000", + "17457.62000000", + "16438.08000000", + "17139.52000000", + "85297.02478700", + 1606521599999, + "1446670351.43508800", + 1572299, + "42507.35843300", + "720985570.34073767", + "0" + ], + [ + 1606521600000, + "17139.53000000", + "17880.49000000", + "16865.56000000", + "17719.85000000", + "64910.69997000", + 1606607999999, + "1128061605.10722507", + 1209385, + "31785.70689800", + "552044705.36061018", + "0" + ], + [ + 1606608000000, + "17719.84000000", + "18360.05000000", + "17517.00000000", + "18184.99000000", + "55329.01630300", + 1606694399999, + "996743798.86492166", + 1141289, + "27883.98529600", + "502287686.11938401", + "0" + ], + [ + 1606694400000, + "18185.00000000", + "19863.16000000", + "18184.99000000", + "19695.87000000", + "115463.46688800", + 1606780799999, + "2205929119.50533619", + 1744149, + "61033.41490300", + "1166943549.18424454", + "0" + ], + [ + 1606780800000, + "19695.87000000", + "19888.00000000", + "18001.12000000", + "18764.96000000", + "127698.76265200", + 1606867199999, + "2446070334.82879867", + 2023802, + "63805.39289800", + "1223282816.31921670", + "0" + ], + [ + 1606867200000, + "18764.96000000", + "19342.00000000", + "18330.00000000", + "19204.09000000", + "75911.01347800", + 1606953599999, + "1436895344.82594950", + 1566635, + "36421.69039800", + "689901298.57006888", + "0" + ], + [ + 1606953600000, + "19204.08000000", + "19598.00000000", + "18867.20000000", + "19421.90000000", + "66689.39127900", + 1607039999999, + "1286548310.82670579", + 1242229, + "33868.34169800", + "653783366.90459527", + "0" + ], + [ + 1607040000000, + "19422.34000000", + "19527.00000000", + "18565.31000000", + "18650.52000000", + "71283.66820000", + 1607126399999, + "1358079975.02549805", + 1286657, + "32363.45371500", + "616745259.31451114", + "0" + ], + [ + 1607126400000, + "18650.51000000", + "19177.00000000", + "18500.00000000", + "19147.66000000", + "42922.74857300", + 1607212799999, + "813445434.13081420", + 932124, + "21360.26028100", + "405002656.06997130", + "0" + ], + [ + 1607212800000, + "19147.66000000", + "19420.00000000", + "18857.00000000", + "19359.40000000", + "37043.09186100", + 1607299199999, + "709558933.58290580", + 820382, + "19009.40766300", + "364303500.95709817", + "0" + ], + [ + 1607299200000, + "19358.67000000", + "19420.91000000", + "18902.88000000", + "19166.90000000", + "41372.29629300", + 1607385599999, + "793517668.68394607", + 840954, + "18881.80601400", + "362249650.05341632", + "0" + ], + [ + 1607385600000, + "19166.90000000", + "19294.84000000", + "18200.00000000", + "18324.11000000", + "61626.94761400", + 1607471999999, + "1160658077.40465900", + 1143181, + "27811.37851000", + "524064471.55038376", + "0" + ], + [ + 1607472000000, + "18324.11000000", + "18639.57000000", + "17650.00000000", + "18541.28000000", + "79585.55380100", + 1607558399999, + "1450130664.06458426", + 1302476, + "36809.00928700", + "671042442.47453077", + "0" + ], + [ + 1607558400000, + "18541.29000000", + "18557.32000000", + "17911.12000000", + "18254.63000000", + "52890.67509400", + 1607644799999, + "966149529.00060708", + 891151, + "25604.60806900", + "467840780.52674688", + "0" + ], + [ + 1607644800000, + "18254.81000000", + "18292.73000000", + "17572.33000000", + "18036.53000000", + "72610.72425900", + 1607731199999, + "1301081647.30790015", + 1117810, + "34194.98847100", + "612882050.91672730", + "0" + ], + [ + 1607731200000, + "18036.53000000", + "18948.66000000", + "18020.70000000", + "18808.69000000", + "49519.97843200", + 1607817599999, + "915552835.90618337", + 891810, + "26056.33264800", + "481756117.71600103", + "0" + ], + [ + 1607817600000, + "18808.69000000", + "19411.00000000", + "18711.12000000", + "19174.99000000", + "56560.82174400", + 1607903999999, + "1083520569.09485384", + 938022, + "29593.46510000", + "566907850.62331193", + "0" + ], + [ + 1607904000000, + "19174.99000000", + "19349.00000000", + "19000.00000000", + "19273.14000000", + "47257.20129400", + 1607990399999, + "906101687.73959502", + 842382, + "22657.46340100", + "434506325.32761055", + "0" + ], + [ + 1607990400000, + "19273.69000000", + "19570.00000000", + "19050.00000000", + "19426.43000000", + "61834.36601100", + 1608076799999, + "1196361527.92580183", + 1046423, + "31194.16084900", + "603826364.41392185", + "0" + ], + [ + 1608076800000, + "19426.43000000", + "21560.00000000", + "19278.60000000", + "21335.52000000", + "114306.33557000", + 1608163199999, + "2325135958.64184128", + 1659135, + "61245.26237500", + "1245917122.17202102", + "0" + ], + [ + 1608163200000, + "21335.52000000", + "23800.00000000", + "21230.00000000", + "22797.16000000", + "184882.47674800", + 1608249599999, + "4196645567.42587731", + 2795084, + "92409.40507900", + "2097021808.62956590", + "0" + ], + [ + 1608249600000, + "22797.15000000", + "23285.18000000", + "22350.00000000", + "23107.39000000", + "79646.13431500", + 1608335999999, + "1820875361.29459761", + 1613775, + "38359.30215800", + "877296889.51146859", + "0" + ], + [ + 1608336000000, + "23107.39000000", + "24171.47000000", + "22750.00000000", + "23821.61000000", + "86045.06467700", + 1608422399999, + "2018969878.88686757", + 1678611, + "42709.11149800", + "1002105538.85929248", + "0" + ], + [ + 1608422400000, + "23821.60000000", + "24295.00000000", + "23060.00000000", + "23455.52000000", + "76690.14568500", + 1608508799999, + "1810862074.73030801", + 1743225, + "37124.11535800", + "877166936.60573439", + "0" + ], + [ + 1608508800000, + "23455.54000000", + "24102.77000000", + "21815.00000000", + "22719.71000000", + "88030.29724300", + 1608595199999, + "2035446293.92897096", + 1593949, + "41983.04610300", + "971417184.68964446", + "0" + ], + [ + 1608595200000, + "22719.88000000", + "23837.10000000", + "22353.40000000", + "23810.79000000", + "87033.12616000", + 1608681599999, + "2010758620.24352682", + 1496277, + "42681.32670800", + "986428672.73760714", + "0" + ], + [ + 1608681600000, + "23810.79000000", + "24100.00000000", + "22600.00000000", + "23232.76000000", + "119047.25973300", + 1608767999999, + "2797688007.07187929", + 2194611, + "56660.20196100", + "1332358610.26840513", + "0" + ], + [ + 1608768000000, + "23232.39000000", + "23794.43000000", + "22703.42000000", + "23729.20000000", + "69013.83425200", + 1608854399999, + "1602394244.07677159", + 1421257, + "35789.11131900", + "831484211.69867196", + "0" + ], + [ + 1608854400000, + "23728.99000000", + "24789.86000000", + "23433.60000000", + "24712.47000000", + "79519.94356900", + 1608940799999, + "1919766316.66773676", + 1504426, + "41219.08816400", + "995215944.57256813", + "0" + ], + [ + 1608940800000, + "24712.47000000", + "26867.03000000", + "24500.00000000", + "26493.39000000", + "97806.51338600", + 1609027199999, + "2496533065.17558060", + 1735574, + "49839.03407200", + "1272279529.88706064", + "0" + ], + [ + 1609027200000, + "26493.40000000", + "28422.00000000", + "25700.00000000", + "26281.66000000", + "148455.58621400", + 1609113599999, + "4028928683.88202470", + 2438493, + "72649.34048400", + "1972635486.18350649", + "0" + ], + [ + 1609113600000, + "26281.54000000", + "27500.00000000", + "26101.00000000", + "27079.41000000", + "79721.74249600", + 1609199999999, + "2151806808.57435257", + 1508204, + "37895.34562100", + "1023061029.36558971", + "0" + ], + [ + 1609200000000, + "27079.42000000", + "27410.00000000", + "25880.00000000", + "27385.00000000", + "69411.59260600", + 1609286399999, + "1851617219.76823461", + 1605166, + "34276.92260100", + "914954320.83476055", + "0" + ], + [ + 1609286400000, + "27385.00000000", + "28996.00000000", + "27320.00000000", + "28875.54000000", + "95356.05782600", + 1609372799999, + "2683953237.46027089", + 1916095, + "48057.90636600", + "1352877359.65147360", + "0" + ], + [ + 1609372800000, + "28875.55000000", + "29300.00000000", + "27850.00000000", + "28923.63000000", + "75508.50515200", + 1609459199999, + "2173600125.42007393", + 1552793, + "36431.62208000", + "1049389143.55620635", + "0" + ], + [ + 1609459200000, + "28923.63000000", + "29600.00000000", + "28624.57000000", + "29331.69000000", + "54182.92501100", + 1609545599999, + "1582526989.16187265", + 1314910, + "27455.80172500", + "802247744.54510409", + "0" + ], + [ + 1609545600000, + "29331.70000000", + "33300.00000000", + "28946.53000000", + "32178.33000000", + "129993.87336200", + 1609631999999, + "4073842163.67154117", + 2245922, + "67446.30524600", + "2110334723.88714587", + "0" + ], + [ + 1609632000000, + "32176.45000000", + "34778.11000000", + "31962.99000000", + "33000.05000000", + "120957.56675000", + 1609718399999, + "4057598425.49201649", + 2369698, + "59750.33287100", + "2004428433.93184622", + "0" + ], + [ + 1609718400000, + "33000.05000000", + "33600.00000000", + "28130.00000000", + "31988.71000000", + "140899.88569000", + 1609804799999, + "4429010349.69534487", + 2642408, + "69088.46923000", + "2173435409.01698791", + "0" + ], + [ + 1609804800000, + "31989.75000000", + "34360.00000000", + "29900.00000000", + "33949.53000000", + "116049.99703800", + 1609891199999, + "3743617144.64691529", + 2526851, + "59691.75475500", + "1927195093.64154965", + "0" + ], + [ + 1609891200000, + "33949.53000000", + "36939.21000000", + "33288.00000000", + "36769.36000000", + "127139.20131000", + 1609977599999, + "4431954248.51961439", + 2591783, + "63052.91465200", + "2199632470.22154891", + "0" + ], + [ + 1609977600000, + "36769.36000000", + "40365.00000000", + "36300.00000000", + "39432.28000000", + "132825.70043700", + 1610063999999, + "5062569943.38337156", + 2814686, + "65055.10713600", + "2482583239.85649706", + "0" + ], + [ + 1610064000000, + "39432.48000000", + "41950.00000000", + "36500.00000000", + "40582.81000000", + "139789.95749900", + 1610150399999, + "5568443208.73136537", + 2925632, + "67300.15521600", + "2684975445.97890497", + "0" + ], + [ + 1610150400000, + "40586.96000000", + "41380.00000000", + "38720.00000000", + "40088.22000000", + "75785.97967500", + 1610236799999, + "3054779029.16177669", + 1998156, + "37007.32190900", + "1491990705.55169908", + "0" + ], + [ + 1610236800000, + "40088.22000000", + "41350.00000000", + "35111.11000000", + "38150.02000000", + "118209.54450300", + 1610323199999, + "4604034729.50707020", + 2628050, + "55451.34467300", + "2160976896.82802737", + "0" + ], + [ + 1610323200000, + "38150.02000000", + "38264.74000000", + "30420.00000000", + "35404.47000000", + "249131.53994300", + 1610409599999, + "8426879770.74001051", + 4431451, + "122133.40619000", + "4133116282.94530164", + "0" + ], + [ + 1610409600000, + "35410.37000000", + "36628.00000000", + "32531.00000000", + "34051.24000000", + "133948.15199600", + 1610495999999, + "4651302423.48411635", + 2674145, + "65098.31019600", + "2261732478.83005161", + "0" + ], + [ + 1610496000000, + "34049.15000000", + "37850.00000000", + "32380.00000000", + "37371.38000000", + "124477.91493800", + 1610582399999, + "4322876606.41962586", + 2514289, + "63981.03830600", + "2222872691.37191206", + "0" + ], + [ + 1610582400000, + "37371.38000000", + "40100.00000000", + "36701.23000000", + "39144.50000000", + "102950.38942100", + 1610668799999, + "3974826638.14508874", + 2297466, + "51264.46709200", + "1979442593.04999946", + "0" + ], + [ + 1610668800000, + "39145.21000000", + "39747.76000000", + "34408.00000000", + "36742.22000000", + "118300.92091600", + 1610755199999, + "4371588898.68163653", + 2560801, + "57738.03422000", + "2133723812.75986223", + "0" + ], + [ + 1610755200000, + "36737.43000000", + "37950.00000000", + "35357.80000000", + "35994.98000000", + "86348.43150800", + 1610841599999, + "3178840336.14928450", + 2066363, + "42420.42373600", + "1563160122.01133437", + "0" + ], + [ + 1610841600000, + "35994.98000000", + "36852.50000000", + "33850.00000000", + "35828.61000000", + "80157.72738400", + 1610927999999, + "2843103040.24066405", + 1860642, + "39513.63856100", + "1402648632.85122460", + "0" + ], + [ + 1610928000000, + "35824.99000000", + "37469.83000000", + "34800.00000000", + "36631.27000000", + "70698.11875000", + 1611014399999, + "2554843260.52439897", + 1707766, + "35621.50604800", + "1289347187.16652892", + "0" + ], + [ + 1611014400000, + "36622.46000000", + "37850.00000000", + "35844.06000000", + "35891.49000000", + "79611.30776900", + 1611100799999, + "2935348499.34421406", + 1939371, + "38704.68162000", + "1428235709.85196932", + "0" + ], + [ + 1611100800000, + "35901.94000000", + "36415.31000000", + "33400.00000000", + "35468.23000000", + "89368.42291800", + 1611187199999, + "3126721093.52077622", + 2234539, + "42546.63407700", + "1489289968.43647013", + "0" + ], + [ + 1611187200000, + "35468.23000000", + "35600.00000000", + "30071.00000000", + "30850.13000000", + "131803.18292600", + 1611273599999, + "4281220573.93542992", + 2820752, + "61805.96152300", + "2009389821.21275978", + "0" + ], + [ + 1611273600000, + "30851.99000000", + "33826.53000000", + "28850.00000000", + "32945.17000000", + "142971.68404900", + 1611359999999, + "4483295872.02227268", + 2707810, + "70150.18845500", + "2201161570.49867076", + "0" + ], + [ + 1611360000000, + "32950.00000000", + "33456.00000000", + "31390.16000000", + "32078.00000000", + "64595.28767500", + 1611446399999, + "2089098295.75843661", + 1700056, + "32680.77612800", + "1057114174.55222724", + "0" + ], + [ + 1611446400000, + "32078.00000000", + "33071.00000000", + "30900.00000000", + "32259.90000000", + "57978.03796600", + 1611532799999, + "1864609665.36570168", + 1528287, + "27826.11919700", + "895721122.01695440", + "0" + ], + [ + 1611532800000, + "32259.45000000", + "34875.00000000", + "31910.00000000", + "32254.20000000", + "88499.22692100", + 1611619199999, + "2958759288.56356839", + 2106548, + "44489.52413200", + "1488432034.49242141", + "0" + ], + [ + 1611619200000, + "32254.19000000", + "32921.88000000", + "30837.37000000", + "32467.77000000", + "84972.20691000", + 1611705599999, + "2708545364.49464120", + 2010392, + "42402.31291700", + "1352678098.86632097", + "0" + ], + [ + 1611705600000, + "32464.01000000", + "32557.29000000", + "29241.72000000", + "30366.15000000", + "95911.96171100", + 1611791999999, + "2958081421.64155914", + 2065953, + "46664.38163800", + "1440079785.12051182", + "0" + ], + [ + 1611792000000, + "30362.19000000", + "33783.98000000", + "29842.10000000", + "33364.86000000", + "92621.14561700", + 1611878399999, + "2953553214.06568187", + 2060660, + "46067.78232600", + "1468956156.48507130", + "0" + ], + [ + 1611878400000, + "33368.18000000", + "38531.90000000", + "31915.40000000", + "34252.20000000", + "231827.00562600", + 1611964799999, + "8195593336.22846664", + 4403349, + "116537.24784700", + "4121941033.63732514", + "0" + ], + [ + 1611964800000, + "34246.28000000", + "34933.00000000", + "32825.00000000", + "34262.88000000", + "84889.68134000", + 1612051199999, + "2884500062.93807842", + 2201040, + "42418.46709900", + "1441981400.65363825", + "0" + ], + [ + 1612051200000, + "34262.89000000", + "34342.69000000", + "32171.67000000", + "33092.98000000", + "68742.28038400", + 1612137599999, + "2289641045.75801233", + 1707064, + "32480.44735800", + "1082502551.52057114", + "0" + ], + [ + 1612137600000, + "33092.97000000", + "34717.27000000", + "32296.16000000", + "33526.37000000", + "82718.27688200", + 1612223999999, + "2791776658.00560560", + 1810492, + "41855.84148600", + "1413158966.72809792", + "0" + ], + [ + 1612224000000, + "33517.09000000", + "35984.33000000", + "33418.00000000", + "35466.24000000", + "78056.65988000", + 1612310399999, + "2716321896.31760851", + 1789672, + "39216.56310600", + "1364790964.63689959", + "0" + ], + [ + 1612310400000, + "35472.71000000", + "37662.63000000", + "35362.38000000", + "37618.87000000", + "80784.33366300", + 1612396799999, + "2951232788.18430528", + 1881740, + "39863.07506000", + "1456248046.14191715", + "0" + ], + [ + 1612396800000, + "37620.26000000", + "38708.27000000", + "36161.95000000", + "36936.66000000", + "92080.73589800", + 1612483199999, + "3452669022.15329251", + 2211866, + "45516.21369000", + "1707710013.88953844", + "0" + ], + [ + 1612483200000, + "36936.65000000", + "38310.12000000", + "36570.00000000", + "38290.24000000", + "66681.33427500", + 1612569599999, + "2509278291.75158661", + 1853253, + "32756.38503100", + "1232713879.83813833", + "0" + ], + [ + 1612569600000, + "38289.32000000", + "40955.51000000", + "38215.94000000", + "39186.94000000", + "98757.31118300", + 1612655999999, + "3922095148.92815047", + 2291646, + "52015.51336200", + "2065180747.34722405", + "0" + ], + [ + 1612656000000, + "39181.01000000", + "39700.00000000", + "37351.00000000", + "38795.69000000", + "84363.67976300", + 1612742399999, + "3256521384.24061093", + 1976357, + "40764.38895900", + "1574482907.56390225", + "0" + ], + [ + 1612742400000, + "38795.69000000", + "46794.45000000", + "37988.89000000", + "46374.87000000", + "138597.53691400", + 1612828799999, + "5881536976.63569947", + 3230961, + "72345.89156800", + "3069313839.44113577", + "0" + ], + [ + 1612828800000, + "46374.86000000", + "48142.19000000", + "44961.09000000", + "46420.42000000", + "115499.86171200", + 1612915199999, + "5386255398.01718726", + 3119034, + "57429.56434700", + "2679451036.49180349", + "0" + ], + [ + 1612915200000, + "46420.42000000", + "47310.00000000", + "43727.00000000", + "44807.58000000", + "97154.18220000", + 1613001599999, + "4431650130.25110525", + 2891592, + "47971.98573100", + "2190231238.81758670", + "0" + ], + [ + 1613001600000, + "44807.58000000", + "48678.90000000", + "43994.02000000", + "47969.51000000", + "89561.08145400", + 1613087999999, + "4185630934.41089499", + 2570949, + "46138.33674000", + "2158335922.69232338", + "0" + ], + [ + 1613088000000, + "47968.66000000", + "48985.80000000", + "46125.00000000", + "47287.60000000", + "85870.03569700", + 1613174399999, + "4080571908.96766153", + 2418841, + "41841.03913500", + "1990472918.92858487", + "0" + ], + [ + 1613174400000, + "47298.15000000", + "48150.00000000", + "46202.53000000", + "47153.69000000", + "63768.09739900", + 1613260799999, + "3007710147.41815964", + 2058823, + "30996.30985900", + "1462495399.99281157", + "0" + ], + [ + 1613260800000, + "47156.78000000", + "49707.43000000", + "47014.17000000", + "48577.79000000", + "73735.47553300", + 1613347199999, + "3584808348.83473272", + 2090070, + "38752.15668100", + "1884009921.06286063", + "0" + ], + [ + 1613347200000, + "48580.47000000", + "49010.92000000", + "45570.79000000", + "47911.10000000", + "79398.15678400", + 1613433599999, + "3782219060.66472205", + 2313155, + "38176.36466100", + "1819251655.78142706", + "0" + ] + ], + "queryString": "endTime=1613347200000\u0026interval=1d\u0026limit=1000\u0026startTime=1598918400000\u0026symbol=BTCUSDT", + "bodyParams": "", + "headers": {} } ] }, diff --git a/testdata/http_mock/bitstamp/bitstamp.json b/testdata/http_mock/bitstamp/bitstamp.json index c104e14c..2ac4b72a 100644 --- a/testdata/http_mock/bitstamp/bitstamp.json +++ b/testdata/http_mock/bitstamp/bitstamp.json @@ -16315,6 +16315,8014 @@ "https://www.bitstamp.net/api/v2/ohlc/btcusd?end=1577836799\u0026limit=1000\u0026start=1546300800\u0026step=86400" ] } + }, + { + "data": { + "data": { + "ohlc": [ + { + "close": "1184.03", + "high": "1197.30", + "low": "1166.66", + "open": "1190.66", + "timestamp": "1491609600", + "volume": "2720.79822734" + }, + { + "close": "1206.20", + "high": "1216.87", + "low": "1173.98", + "open": "1184.05", + "timestamp": "1491696000", + "volume": "4817.42424874" + }, + { + "close": "1209.25", + "high": "1219.71", + "low": "1195.00", + "open": "1205.20", + "timestamp": "1491782400", + "volume": "3656.81631296" + }, + { + "close": "1218.99", + "high": "1229.00", + "low": "1198.02", + "open": "1209.99", + "timestamp": "1491868800", + "volume": "3487.75310814" + }, + { + "close": "1212.17", + "high": "1224.57", + "low": "1208.00", + "open": "1218.99", + "timestamp": "1491955200", + "volume": "3475.19462571" + }, + { + "close": "1172.91", + "high": "1219.45", + "low": "1141.00", + "open": "1212.16", + "timestamp": "1492041600", + "volume": "7135.30295650" + }, + { + "close": "1170.34", + "high": "1193.00", + "low": "1142.00", + "open": "1172.56", + "timestamp": "1492128000", + "volume": "8982.76789635" + }, + { + "close": "1173.45", + "high": "1192.50", + "low": "1165.00", + "open": "1169.53", + "timestamp": "1492214400", + "volume": "1804.45079680" + }, + { + "close": "1162.31", + "high": "1179.30", + "low": "1150.00", + "open": "1171.00", + "timestamp": "1492300800", + "volume": "2663.99028304" + }, + { + "close": "1176.54", + "high": "1192.50", + "low": "1161.00", + "open": "1162.31", + "timestamp": "1492387200", + "volume": "3568.82507477" + }, + { + "close": "1202.58", + "high": "1210.00", + "low": "1175.95", + "open": "1176.59", + "timestamp": "1492473600", + "volume": "5514.18240451" + }, + { + "close": "1203.98", + "high": "1209.99", + "low": "1190.00", + "open": "1202.59", + "timestamp": "1492560000", + "volume": "6046.51943656" + }, + { + "close": "1234.19", + "high": "1243.88", + "low": "1201.66", + "open": "1203.98", + "timestamp": "1492646400", + "volume": "5972.93539154" + }, + { + "close": "1243.61", + "high": "1252.32", + "low": "1231.65", + "open": "1234.93", + "timestamp": "1492732800", + "volume": "5023.03852040" + }, + { + "close": "1233.20", + "high": "1247.15", + "low": "1199.00", + "open": "1243.60", + "timestamp": "1492819200", + "volume": "4173.28321472" + }, + { + "close": "1241.99", + "high": "1248.99", + "low": "1223.42", + "open": "1231.85", + "timestamp": "1492905600", + "volume": "2604.72196524" + }, + { + "close": "1253.58", + "high": "1254.00", + "low": "1234.00", + "open": "1242.00", + "timestamp": "1492992000", + "volume": "3048.68890003" + }, + { + "close": "1269.00", + "high": "1280.00", + "low": "1251.07", + "open": "1253.57", + "timestamp": "1493078400", + "volume": "5249.77353318" + }, + { + "close": "1287.99", + "high": "1330.00", + "low": "1265.00", + "open": "1271.40", + "timestamp": "1493164800", + "volume": "8707.63904245" + }, + { + "close": "1331.53", + "high": "1342.02", + "low": "1285.00", + "open": "1287.92", + "timestamp": "1493251200", + "volume": "6669.98746832" + }, + { + "close": "1330.70", + "high": "1347.02", + "low": "1299.00", + "open": "1331.00", + "timestamp": "1493337600", + "volume": "8234.27554370" + }, + { + "close": "1333.00", + "high": "1342.80", + "low": "1316.00", + "open": "1333.93", + "timestamp": "1493424000", + "volume": "3927.45061482" + }, + { + "close": "1350.21", + "high": "1356.00", + "low": "1315.68", + "open": "1336.77", + "timestamp": "1493510400", + "volume": "3536.17581110" + }, + { + "close": "1390.86", + "high": "1425.00", + "low": "1341.22", + "open": "1348.88", + "timestamp": "1493596800", + "volume": "8604.41493207" + }, + { + "close": "1447.75", + "high": "1481.73", + "low": "1388.00", + "open": "1390.86", + "timestamp": "1493683200", + "volume": "8920.68985793" + }, + { + "close": "1503.22", + "high": "1516.04", + "low": "1431.02", + "open": "1447.75", + "timestamp": "1493769600", + "volume": "11077.58948720" + }, + { + "close": "1537.23", + "high": "1623.01", + "low": "1444.94", + "open": "1503.25", + "timestamp": "1493856000", + "volume": "19548.52973673" + }, + { + "close": "1514.90", + "high": "1609.00", + "low": "1495.00", + "open": "1537.36", + "timestamp": "1493942400", + "volume": "15603.68436616" + }, + { + "close": "1558.02", + "high": "1578.97", + "low": "1505.00", + "open": "1515.39", + "timestamp": "1494028800", + "volume": "7901.14284010" + }, + { + "close": "1554.01", + "high": "1565.00", + "low": "1525.00", + "open": "1554.04", + "timestamp": "1494115200", + "volume": "7667.78585113" + }, + { + "close": "1649.54", + "high": "1653.97", + "low": "1554.38", + "open": "1554.38", + "timestamp": "1494201600", + "volume": "19262.35352625" + }, + { + "close": "1720.28", + "high": "1760.40", + "low": "1616.05", + "open": "1649.55", + "timestamp": "1494288000", + "volume": "16807.73323227" + }, + { + "close": "1772.58", + "high": "1794.21", + "low": "1682.00", + "open": "1720.26", + "timestamp": "1494374400", + "volume": "11265.37863829" + }, + { + "close": "1828.45", + "high": "1892.00", + "low": "1745.01", + "open": "1774.52", + "timestamp": "1494460800", + "volume": "14740.21932638" + }, + { + "close": "1691.51", + "high": "1832.00", + "low": "1650.00", + "open": "1830.85", + "timestamp": "1494547200", + "volume": "17062.84462773" + }, + { + "close": "1776.89", + "high": "1785.82", + "low": "1601.46", + "open": "1690.33", + "timestamp": "1494633600", + "volume": "10532.23451343" + }, + { + "close": "1784.00", + "high": "1815.00", + "low": "1753.00", + "open": "1776.80", + "timestamp": "1494720000", + "volume": "4816.73208815" + }, + { + "close": "1705.48", + "high": "1784.00", + "low": "1682.56", + "open": "1782.30", + "timestamp": "1494806400", + "volume": "13316.80217814" + }, + { + "close": "1700.01", + "high": "1750.00", + "low": "1641.22", + "open": "1706.07", + "timestamp": "1494892800", + "volume": "16554.08858020" + }, + { + "close": "1782.99", + "high": "1840.42", + "low": "1670.01", + "open": "1700.01", + "timestamp": "1494979200", + "volume": "17797.31852412" + }, + { + "close": "1878.99", + "high": "1881.80", + "low": "1766.33", + "open": "1779.00", + "timestamp": "1495065600", + "volume": "11916.12339070" + }, + { + "close": "1958.00", + "high": "1969.99", + "low": "1874.99", + "open": "1879.00", + "timestamp": "1495152000", + "volume": "14124.61831495" + }, + { + "close": "2013.99", + "high": "2021.00", + "low": "1914.00", + "open": "1959.09", + "timestamp": "1495238400", + "volume": "12309.94747354" + }, + { + "close": "2017.55", + "high": "2063.11", + "low": "1961.52", + "open": "2013.99", + "timestamp": "1495324800", + "volume": "6755.83436855" + }, + { + "close": "2099.97", + "high": "2230.34", + "low": "2001.00", + "open": "2017.55", + "timestamp": "1495411200", + "volume": "16338.53540635" + }, + { + "close": "2264.23", + "high": "2275.00", + "low": "2088.45", + "open": "2088.76", + "timestamp": "1495497600", + "volume": "14138.91966835" + }, + { + "close": "2420.29", + "high": "2481.75", + "low": "2264.64", + "open": "2265.90", + "timestamp": "1495584000", + "volume": "22144.59820110" + }, + { + "close": "2292.53", + "high": "2760.10", + "low": "2221.00", + "open": "2420.29", + "timestamp": "1495670400", + "volume": "32964.76142591" + }, + { + "close": "2279.82", + "high": "2599.12", + "low": "2060.00", + "open": "2277.01", + "timestamp": "1495756800", + "volume": "28326.82201443" + }, + { + "close": "2042.00", + "high": "2339.94", + "low": "1850.00", + "open": "2280.70", + "timestamp": "1495843200", + "volume": "26216.27512690" + }, + { + "close": "2178.81", + "high": "2313.96", + "low": "2041.48", + "open": "2042.89", + "timestamp": "1495929600", + "volume": "15375.21812611" + }, + { + "close": "2292.10", + "high": "2350.00", + "low": "2110.00", + "open": "2172.54", + "timestamp": "1496016000", + "volume": "12129.27808588" + }, + { + "close": "2203.51", + "high": "2339.08", + "low": "2160.00", + "open": "2290.18", + "timestamp": "1496102400", + "volume": "13888.85097299" + }, + { + "close": "2298.01", + "high": "2334.00", + "low": "2154.28", + "open": "2201.70", + "timestamp": "1496188800", + "volume": "16279.29243150" + }, + { + "close": "2413.63", + "high": "2456.39", + "low": "2296.81", + "open": "2298.01", + "timestamp": "1496275200", + "volume": "18401.66360125" + }, + { + "close": "2488.94", + "high": "2489.00", + "low": "2370.03", + "open": "2413.58", + "timestamp": "1496361600", + "volume": "12428.70059429" + }, + { + "close": "2540.94", + "high": "2584.34", + "low": "2445.00", + "open": "2488.94", + "timestamp": "1496448000", + "volume": "10810.58468925" + }, + { + "close": "2530.27", + "high": "2569.00", + "low": "2460.00", + "open": "2538.10", + "timestamp": "1496534400", + "volume": "8828.62494281" + }, + { + "close": "2698.00", + "high": "2699.35", + "low": "2525.28", + "open": "2530.27", + "timestamp": "1496620800", + "volume": "12221.44480600" + }, + { + "close": "2880.74", + "high": "2933.00", + "low": "2689.40", + "open": "2698.00", + "timestamp": "1496707200", + "volume": "26695.67081758" + }, + { + "close": "2683.03", + "high": "2893.28", + "low": "2612.50", + "open": "2875.71", + "timestamp": "1496793600", + "volume": "16967.04353572" + }, + { + "close": "2806.00", + "high": "2815.00", + "low": "2613.13", + "open": "2680.24", + "timestamp": "1496880000", + "volume": "13251.40544911" + }, + { + "close": "2822.32", + "high": "2868.23", + "low": "2780.43", + "open": "2805.46", + "timestamp": "1496966400", + "volume": "8036.31356941" + }, + { + "close": "2899.99", + "high": "2912.98", + "low": "2800.00", + "open": "2818.00", + "timestamp": "1497052800", + "volume": "9593.36119146" + }, + { + "close": "2954.22", + "high": "2967.46", + "low": "2861.53", + "open": "2899.01", + "timestamp": "1497139200", + "volume": "6830.60683981" + }, + { + "close": "2667.06", + "high": "2980.00", + "low": "2480.03", + "open": "2954.23", + "timestamp": "1497225600", + "volume": "31534.94605550" + }, + { + "close": "2703.02", + "high": "2783.62", + "low": "2638.62", + "open": "2656.97", + "timestamp": "1497312000", + "volume": "16275.83441252" + }, + { + "close": "2450.00", + "high": "2801.00", + "low": "2320.00", + "open": "2705.99", + "timestamp": "1497398400", + "volume": "29478.82028393" + }, + { + "close": "2424.91", + "high": "2516.20", + "low": "2120.00", + "open": "2451.42", + "timestamp": "1497484800", + "volume": "36751.09130817" + }, + { + "close": "2484.68", + "high": "2540.00", + "low": "2307.66", + "open": "2424.96", + "timestamp": "1497571200", + "volume": "13802.39329983" + }, + { + "close": "2630.00", + "high": "2674.40", + "low": "2420.53", + "open": "2484.68", + "timestamp": "1497657600", + "volume": "11142.98518556" + }, + { + "close": "2516.98", + "high": "2665.00", + "low": "2460.62", + "open": "2630.06", + "timestamp": "1497744000", + "volume": "9424.23118056" + }, + { + "close": "2598.00", + "high": "2598.00", + "low": "2480.96", + "open": "2516.98", + "timestamp": "1497830400", + "volume": "10570.67252500" + }, + { + "close": "2740.00", + "high": "2783.00", + "low": "2581.00", + "open": "2598.00", + "timestamp": "1497916800", + "volume": "15891.69948817" + }, + { + "close": "2657.04", + "high": "2789.00", + "low": "2611.00", + "open": "2734.03", + "timestamp": "1498003200", + "volume": "15676.32352625" + }, + { + "close": "2713.48", + "high": "2740.00", + "low": "2594.61", + "open": "2658.67", + "timestamp": "1498089600", + "volume": "10792.78764641" + }, + { + "close": "2685.05", + "high": "2745.00", + "low": "2657.46", + "open": "2713.48", + "timestamp": "1498176000", + "volume": "8232.48064925" + }, + { + "close": "2557.66", + "high": "2724.96", + "low": "2512.13", + "open": "2685.05", + "timestamp": "1498262400", + "volume": "13342.81785584" + }, + { + "close": "2502.03", + "high": "2635.72", + "low": "2432.00", + "open": "2557.66", + "timestamp": "1498348800", + "volume": "10339.57437415" + }, + { + "close": "2421.22", + "high": "2550.03", + "low": "2315.01", + "open": "2502.26", + "timestamp": "1498435200", + "volume": "22094.21151071" + }, + { + "close": "2565.00", + "high": "2565.00", + "low": "2291.00", + "open": "2421.21", + "timestamp": "1498521600", + "volume": "19129.59650756" + }, + { + "close": "2559.90", + "high": "2593.00", + "low": "2468.01", + "open": "2565.00", + "timestamp": "1498608000", + "volume": "12274.54530348" + }, + { + "close": "2541.59", + "high": "2594.78", + "low": "2500.31", + "open": "2550.99", + "timestamp": "1498694400", + "volume": "8125.37763725" + }, + { + "close": "2465.49", + "high": "2564.58", + "low": "2451.00", + "open": "2538.41", + "timestamp": "1498780800", + "volume": "8715.71676156" + }, + { + "close": "2412.41", + "high": "2517.11", + "low": "2390.00", + "open": "2465.48", + "timestamp": "1498867200", + "volume": "8885.89349655" + }, + { + "close": "2504.37", + "high": "2528.72", + "low": "2374.34", + "open": "2421.30", + "timestamp": "1498953600", + "volume": "8744.53441127" + }, + { + "close": "2550.47", + "high": "2595.00", + "low": "2472.68", + "open": "2504.81", + "timestamp": "1499040000", + "volume": "11520.70730801" + }, + { + "close": "2596.12", + "high": "2639.47", + "low": "2540.07", + "open": "2540.07", + "timestamp": "1499126400", + "volume": "9662.75941445" + }, + { + "close": "2602.90", + "high": "2623.00", + "low": "2530.10", + "open": "2594.52", + "timestamp": "1499212800", + "volume": "10882.83901071" + }, + { + "close": "2600.39", + "high": "2614.00", + "low": "2522.00", + "open": "2598.37", + "timestamp": "1499299200", + "volume": "8333.98094907" + }, + { + "close": "2501.46", + "high": "2605.00", + "low": "2475.00", + "open": "2599.01", + "timestamp": "1499385600", + "volume": "9430.61545780" + }, + { + "close": "2550.07", + "high": "2555.00", + "low": "2462.00", + "open": "2501.46", + "timestamp": "1499472000", + "volume": "5405.89088691" + }, + { + "close": "2502.28", + "high": "2564.65", + "low": "2500.50", + "open": "2550.13", + "timestamp": "1499558400", + "volume": "4483.14413363" + }, + { + "close": "2323.45", + "high": "2527.88", + "low": "2261.85", + "open": "2504.00", + "timestamp": "1499644800", + "volume": "17296.34045274" + }, + { + "close": "2305.98", + "high": "2399.00", + "low": "2242.62", + "open": "2326.12", + "timestamp": "1499731200", + "volume": "17580.96163529" + }, + { + "close": "2388.00", + "high": "2408.84", + "low": "2239.54", + "open": "2301.55", + "timestamp": "1499817600", + "volume": "12883.55493809" + }, + { + "close": "2339.99", + "high": "2425.16", + "low": "2312.93", + "open": "2383.97", + "timestamp": "1499904000", + "volume": "8429.85040306" + }, + { + "close": "2213.37", + "high": "2357.84", + "low": "2140.00", + "open": "2340.00", + "timestamp": "1499990400", + "volume": "12659.01704362" + }, + { + "close": "1970.51", + "high": "2219.99", + "low": "1967.65", + "open": "2209.44", + "timestamp": "1500076800", + "volume": "19886.67952318" + }, + { + "close": "1917.63", + "high": "2044.44", + "low": "1830.00", + "open": "1970.51", + "timestamp": "1500163200", + "volume": "25562.70564457" + }, + { + "close": "2226.00", + "high": "2229.97", + "low": "1910.57", + "open": "1917.72", + "timestamp": "1500249600", + "volume": "26448.50140255" + }, + { + "close": "2303.71", + "high": "2392.00", + "low": "2164.00", + "open": "2226.00", + "timestamp": "1500336000", + "volume": "25204.48960246" + }, + { + "close": "2265.21", + "high": "2402.50", + "low": "2223.00", + "open": "2308.82", + "timestamp": "1500422400", + "volume": "17009.88349592" + }, + { + "close": "2875.03", + "high": "2938.00", + "low": "2265.51", + "open": "2265.51", + "timestamp": "1500508800", + "volume": "30989.89112526" + }, + { + "close": "2670.00", + "high": "2887.45", + "low": "2611.39", + "open": "2880.00", + "timestamp": "1500595200", + "volume": "20724.16050338" + }, + { + "close": "2832.71", + "high": "2882.00", + "low": "2644.59", + "open": "2667.01", + "timestamp": "1500681600", + "volume": "12819.63134804" + }, + { + "close": "2749.02", + "high": "2855.00", + "low": "2640.00", + "open": "2824.82", + "timestamp": "1500768000", + "volume": "11001.96460067" + }, + { + "close": "2759.98", + "high": "2800.00", + "low": "2701.00", + "open": "2756.80", + "timestamp": "1500854400", + "volume": "10001.91506610" + }, + { + "close": "2564.82", + "high": "2775.79", + "low": "2450.00", + "open": "2759.95", + "timestamp": "1500940800", + "volume": "21326.54783885" + }, + { + "close": "2524.99", + "high": "2608.96", + "low": "2400.00", + "open": "2564.74", + "timestamp": "1501027200", + "volume": "17713.67446580" + }, + { + "close": "2666.33", + "high": "2695.00", + "low": "2509.63", + "open": "2524.99", + "timestamp": "1501113600", + "volume": "11826.47519948" + }, + { + "close": "2777.01", + "high": "2825.00", + "low": "2655.82", + "open": "2666.33", + "timestamp": "1501200000", + "volume": "14069.50149214" + }, + { + "close": "2680.56", + "high": "2785.65", + "low": "2631.78", + "open": "2777.01", + "timestamp": "1501286400", + "volume": "10782.21753675" + }, + { + "close": "2742.37", + "high": "2774.45", + "low": "2569.69", + "open": "2681.60", + "timestamp": "1501372800", + "volume": "9678.16126067" + }, + { + "close": "2855.81", + "high": "2889.99", + "low": "2680.01", + "open": "2745.76", + "timestamp": "1501459200", + "volume": "11114.33554221" + }, + { + "close": "2731.00", + "high": "2929.17", + "low": "2615.00", + "open": "2855.81", + "timestamp": "1501545600", + "volume": "12525.07669112" + }, + { + "close": "2703.51", + "high": "2760.00", + "low": "2650.00", + "open": "2732.00", + "timestamp": "1501632000", + "volume": "9486.62552563" + }, + { + "close": "2793.37", + "high": "2807.44", + "low": "2698.83", + "open": "2703.51", + "timestamp": "1501718400", + "volume": "7963.69799924" + }, + { + "close": "2855.00", + "high": "2877.52", + "low": "2765.91", + "open": "2793.34", + "timestamp": "1501804800", + "volume": "7635.82167190" + }, + { + "close": "3263.62", + "high": "3339.66", + "low": "2848.32", + "open": "2851.01", + "timestamp": "1501891200", + "volume": "16996.27310091" + }, + { + "close": "3222.75", + "high": "3296.51", + "low": "3146.10", + "open": "3263.51", + "timestamp": "1501977600", + "volume": "5998.73578852" + }, + { + "close": "3387.55", + "high": "3430.00", + "low": "3186.00", + "open": "3216.78", + "timestamp": "1502064000", + "volume": "12046.11726501" + }, + { + "close": "3412.41", + "high": "3490.00", + "low": "3300.00", + "open": "3387.54", + "timestamp": "1502150400", + "volume": "15835.37020781" + }, + { + "close": "3342.99", + "high": "3423.10", + "low": "3178.72", + "open": "3408.46", + "timestamp": "1502236800", + "volume": "14286.84413824" + }, + { + "close": "3413.03", + "high": "3448.00", + "low": "3311.17", + "open": "3342.99", + "timestamp": "1502323200", + "volume": "9031.12128021" + }, + { + "close": "3645.06", + "high": "3705.00", + "low": "3390.67", + "open": "3410.00", + "timestamp": "1502409600", + "volume": "11927.37333424" + }, + { + "close": "3855.10", + "high": "3934.00", + "low": "3586.95", + "open": "3651.74", + "timestamp": "1502496000", + "volume": "12351.07466143" + }, + { + "close": "4053.87", + "high": "4190.00", + "low": "3841.71", + "open": "3855.04", + "timestamp": "1502582400", + "volume": "15889.82978854" + }, + { + "close": "4306.23", + "high": "4329.43", + "low": "3964.96", + "open": "4053.87", + "timestamp": "1502668800", + "volume": "14212.30420724" + }, + { + "close": "4155.67", + "high": "4400.00", + "low": "3800.00", + "open": "4320.95", + "timestamp": "1502755200", + "volume": "25515.71801437" + }, + { + "close": "4378.84", + "high": "4379.78", + "low": "3926.06", + "open": "4154.99", + "timestamp": "1502841600", + "volume": "12923.63728054" + }, + { + "close": "4276.50", + "high": "4480.00", + "low": "4167.21", + "open": "4361.99", + "timestamp": "1502928000", + "volume": "14573.18592909" + }, + { + "close": "4100.00", + "high": "4368.00", + "low": "3964.96", + "open": "4260.47", + "timestamp": "1503014400", + "volume": "17516.99336076" + }, + { + "close": "4099.55", + "high": "4188.00", + "low": "3900.00", + "open": "4100.00", + "timestamp": "1503100800", + "volume": "15036.18405113" + }, + { + "close": "4058.68", + "high": "4125.95", + "low": "4000.00", + "open": "4091.99", + "timestamp": "1503187200", + "volume": "6237.97289632" + }, + { + "close": "3987.52", + "high": "4080.00", + "low": "3949.78", + "open": "4058.64", + "timestamp": "1503273600", + "volume": "9782.05659401" + }, + { + "close": "4085.00", + "high": "4139.31", + "low": "3600.00", + "open": "3987.51", + "timestamp": "1503360000", + "volume": "23522.75816636" + }, + { + "close": "4108.12", + "high": "4248.97", + "low": "4051.94", + "open": "4078.00", + "timestamp": "1503446400", + "volume": "14979.40348147" + }, + { + "close": "4300.34", + "high": "4350.00", + "low": "4082.57", + "open": "4121.78", + "timestamp": "1503532800", + "volume": "10782.69436738" + }, + { + "close": "4355.98", + "high": "4449.98", + "low": "4270.00", + "open": "4308.80", + "timestamp": "1503619200", + "volume": "9699.61003374" + }, + { + "close": "4333.38", + "high": "4369.78", + "low": "4232.43", + "open": "4348.17", + "timestamp": "1503705600", + "volume": "6559.66860375" + }, + { + "close": "4337.68", + "high": "4393.30", + "low": "4290.32", + "open": "4333.38", + "timestamp": "1503792000", + "volume": "3979.12445283" + }, + { + "close": "4379.99", + "high": "4399.72", + "low": "4169.01", + "open": "4329.91", + "timestamp": "1503878400", + "volume": "8641.00244590" + }, + { + "close": "4578.82", + "high": "4649.78", + "low": "4336.26", + "open": "4385.00", + "timestamp": "1503964800", + "volume": "11879.64283069" + }, + { + "close": "4573.20", + "high": "4642.22", + "low": "4479.00", + "open": "4578.82", + "timestamp": "1504051200", + "volume": "8720.03503995" + }, + { + "close": "4734.26", + "high": "4765.21", + "low": "4566.66", + "open": "4573.15", + "timestamp": "1504137600", + "volume": "8911.41245939" + }, + { + "close": "4921.70", + "high": "4935.00", + "low": "4671.09", + "open": "4734.26", + "timestamp": "1504224000", + "volume": "15367.52969736" + }, + { + "close": "4599.90", + "high": "4979.90", + "low": "4488.50", + "open": "4921.71", + "timestamp": "1504310400", + "volume": "16977.79362226" + }, + { + "close": "4606.26", + "high": "4700.00", + "low": "4385.00", + "open": "4599.90", + "timestamp": "1504396800", + "volume": "11224.91455630" + }, + { + "close": "4277.00", + "high": "4613.97", + "low": "4058.50", + "open": "4603.68", + "timestamp": "1504483200", + "volume": "25069.12523005" + }, + { + "close": "4396.52", + "high": "4474.88", + "low": "4001.93", + "open": "4282.53", + "timestamp": "1504569600", + "volume": "20884.21969353" + }, + { + "close": "4605.80", + "high": "4649.23", + "low": "4356.42", + "open": "4397.38", + "timestamp": "1504656000", + "volume": "16634.10420534" + }, + { + "close": "4615.00", + "high": "4674.34", + "low": "4475.00", + "open": "4605.81", + "timestamp": "1504742400", + "volume": "9254.85142692" + }, + { + "close": "4312.00", + "high": "4679.97", + "low": "4125.99", + "open": "4615.00", + "timestamp": "1504828800", + "volume": "23693.30162259" + }, + { + "close": "4308.72", + "high": "4379.78", + "low": "4164.00", + "open": "4327.41", + "timestamp": "1504915200", + "volume": "9974.38823453" + }, + { + "close": "4226.22", + "high": "4322.44", + "low": "4010.00", + "open": "4322.44", + "timestamp": "1505001600", + "volume": "14724.20414387" + }, + { + "close": "4207.31", + "high": "4353.49", + "low": "4092.40", + "open": "4226.21", + "timestamp": "1505088000", + "volume": "11191.59504385" + }, + { + "close": "4172.56", + "high": "4377.65", + "low": "4080.00", + "open": "4198.89", + "timestamp": "1505174400", + "volume": "13294.43769742" + }, + { + "close": "3865.34", + "high": "4179.14", + "low": "3720.01", + "open": "4170.60", + "timestamp": "1505260800", + "volume": "29636.38096311" + }, + { + "close": "3227.79", + "high": "3921.74", + "low": "3210.00", + "open": "3861.89", + "timestamp": "1505347200", + "volume": "41319.39712570" + }, + { + "close": "3700.01", + "high": "3820.00", + "low": "2972.01", + "open": "3227.79", + "timestamp": "1505433600", + "volume": "60278.94654177" + }, + { + "close": "3678.93", + "high": "3872.90", + "low": "3500.00", + "open": "3699.89", + "timestamp": "1505520000", + "volume": "23158.22891071" + }, + { + "close": "3662.99", + "high": "3772.52", + "low": "3463.00", + "open": "3669.07", + "timestamp": "1505606400", + "volume": "11770.21765049" + }, + { + "close": "4101.60", + "high": "4122.70", + "low": "3659.42", + "open": "3662.95", + "timestamp": "1505692800", + "volume": "17207.59892439" + }, + { + "close": "3888.80", + "high": "4119.70", + "low": "3848.35", + "open": "4102.00", + "timestamp": "1505779200", + "volume": "15278.93044040" + }, + { + "close": "3874.46", + "high": "4050.00", + "low": "3820.56", + "open": "3888.80", + "timestamp": "1505865600", + "volume": "11660.27181331" + }, + { + "close": "3617.05", + "high": "3914.00", + "low": "3573.00", + "open": "3864.00", + "timestamp": "1505952000", + "volume": "17904.29717206" + }, + { + "close": "3612.18", + "high": "3761.84", + "low": "3514.00", + "open": "3607.83", + "timestamp": "1506038400", + "volume": "15007.73844949" + }, + { + "close": "3779.17", + "high": "3810.25", + "low": "3552.00", + "open": "3611.91", + "timestamp": "1506124800", + "volume": "10123.23213552" + }, + { + "close": "3664.22", + "high": "3783.25", + "low": "3615.00", + "open": "3781.13", + "timestamp": "1506211200", + "volume": "6508.72499023" + }, + { + "close": "3918.00", + "high": "3968.59", + "low": "3658.39", + "open": "3667.01", + "timestamp": "1506297600", + "volume": "14979.78226289" + }, + { + "close": "3888.03", + "high": "3970.00", + "low": "3850.61", + "open": "3920.66", + "timestamp": "1506384000", + "volume": "10014.62367124" + }, + { + "close": "4199.29", + "high": "4226.73", + "low": "3870.00", + "open": "3883.95", + "timestamp": "1506470400", + "volume": "15075.83871664" + }, + { + "close": "4184.84", + "high": "4270.01", + "low": "4123.50", + "open": "4202.34", + "timestamp": "1506556800", + "volume": "9625.92938226" + }, + { + "close": "4164.82", + "high": "4227.62", + "low": "4022.02", + "open": "4183.47", + "timestamp": "1506643200", + "volume": "12191.93065131" + }, + { + "close": "4326.09", + "high": "4349.00", + "low": "4154.28", + "open": "4162.04", + "timestamp": "1506729600", + "volume": "7496.78249925" + }, + { + "close": "4377.22", + "high": "4377.22", + "low": "4216.00", + "open": "4326.09", + "timestamp": "1506816000", + "volume": "7211.33513580" + }, + { + "close": "4391.48", + "high": "4453.00", + "low": "4352.00", + "open": "4369.33", + "timestamp": "1506902400", + "volume": "8259.81863150" + }, + { + "close": "4315.83", + "high": "4425.00", + "low": "4218.00", + "open": "4391.41", + "timestamp": "1506988800", + "volume": "12468.05725642" + }, + { + "close": "4219.53", + "high": "4343.00", + "low": "4170.07", + "open": "4315.73", + "timestamp": "1507075200", + "volume": "8518.99274917" + }, + { + "close": "4301.09", + "high": "4358.97", + "low": "4137.96", + "open": "4219.74", + "timestamp": "1507161600", + "volume": "8419.96284162" + }, + { + "close": "4362.95", + "high": "4425.00", + "low": "4278.40", + "open": "4301.09", + "timestamp": "1507248000", + "volume": "8377.30164966" + }, + { + "close": "4423.30", + "high": "4463.00", + "low": "4312.82", + "open": "4356.09", + "timestamp": "1507334400", + "volume": "4646.40562117" + }, + { + "close": "4597.98", + "high": "4612.00", + "low": "4404.50", + "open": "4422.72", + "timestamp": "1507420800", + "volume": "10083.86684927" + }, + { + "close": "4764.70", + "high": "4865.00", + "low": "4541.00", + "open": "4597.97", + "timestamp": "1507507200", + "volume": "12923.66661677" + }, + { + "close": "4749.29", + "high": "4909.97", + "low": "4700.00", + "open": "4761.67", + "timestamp": "1507593600", + "volume": "11666.02496241" + }, + { + "close": "4822.01", + "high": "4869.78", + "low": "4700.00", + "open": "4747.90", + "timestamp": "1507680000", + "volume": "9866.89562175" + }, + { + "close": "5445.00", + "high": "5445.00", + "low": "4793.66", + "open": "4822.01", + "timestamp": "1507766400", + "volume": "19916.22801995" + }, + { + "close": "5653.60", + "high": "5846.43", + "low": "5380.00", + "open": "5444.00", + "timestamp": "1507852800", + "volume": "27827.38028536" + }, + { + "close": "5801.29", + "high": "5817.34", + "low": "5558.26", + "open": "5653.58", + "timestamp": "1507939200", + "volume": "8410.93623080" + }, + { + "close": "5679.70", + "high": "5830.00", + "low": "5415.00", + "open": "5795.01", + "timestamp": "1508025600", + "volume": "11542.94583367" + }, + { + "close": "5745.72", + "high": "5807.11", + "low": "5548.00", + "open": "5683.92", + "timestamp": "1508112000", + "volume": "9066.79974453" + }, + { + "close": "5597.31", + "high": "5776.31", + "low": "5506.78", + "open": "5752.20", + "timestamp": "1508198400", + "volume": "9105.28187907" + }, + { + "close": "5582.05", + "high": "5617.75", + "low": "5101.36", + "open": "5591.97", + "timestamp": "1508284800", + "volume": "18961.67579669" + }, + { + "close": "5698.69", + "high": "5735.14", + "low": "5512.06", + "open": "5572.64", + "timestamp": "1508371200", + "volume": "9919.83821694" + }, + { + "close": "5977.29", + "high": "6074.00", + "low": "5589.80", + "open": "5700.00", + "timestamp": "1508457600", + "volume": "15109.06365101" + }, + { + "close": "6013.46", + "high": "6180.00", + "low": "5871.00", + "open": "5977.26", + "timestamp": "1508544000", + "volume": "15357.42373371" + }, + { + "close": "5969.00", + "high": "6071.07", + "low": "5700.00", + "open": "6010.85", + "timestamp": "1508630400", + "volume": "12232.52332991" + }, + { + "close": "5871.17", + "high": "6045.34", + "low": "5617.75", + "open": "5967.38", + "timestamp": "1508716800", + "volume": "15331.63502934" + }, + { + "close": "5523.40", + "high": "5870.00", + "low": "5453.01", + "open": "5869.82", + "timestamp": "1508803200", + "volume": "17286.72373931" + }, + { + "close": "5735.88", + "high": "5748.00", + "low": "5366.00", + "open": "5518.49", + "timestamp": "1508889600", + "volume": "12349.10670220" + }, + { + "close": "5890.00", + "high": "5988.00", + "low": "5683.00", + "open": "5741.35", + "timestamp": "1508976000", + "volume": "11788.30258919" + }, + { + "close": "5771.89", + "high": "5994.06", + "low": "5674.06", + "open": "5889.99", + "timestamp": "1509062400", + "volume": "11911.04199625" + }, + { + "close": "5730.69", + "high": "5875.66", + "low": "5646.18", + "open": "5773.03", + "timestamp": "1509148800", + "volume": "5926.29737158" + }, + { + "close": "6137.37", + "high": "6316.85", + "low": "5683.00", + "open": "5731.70", + "timestamp": "1509235200", + "volume": "16086.62569466" + }, + { + "close": "6119.99", + "high": "6229.77", + "low": "6024.03", + "open": "6133.01", + "timestamp": "1509321600", + "volume": "9574.64365313" + }, + { + "close": "6434.21", + "high": "6449.78", + "low": "6072.81", + "open": "6120.00", + "timestamp": "1509408000", + "volume": "13423.30855051" + }, + { + "close": "6741.59", + "high": "6756.36", + "low": "6340.01", + "open": "6434.24", + "timestamp": "1509494400", + "volume": "12967.22211638" + }, + { + "close": "7030.00", + "high": "7354.10", + "low": "6700.00", + "open": "6745.04", + "timestamp": "1509580800", + "volume": "26514.65119452" + }, + { + "close": "7146.82", + "high": "7500.00", + "low": "6925.22", + "open": "7030.00", + "timestamp": "1509667200", + "volume": "15999.78379684" + }, + { + "close": "7388.83", + "high": "7569.90", + "low": "6994.00", + "open": "7145.24", + "timestamp": "1509753600", + "volume": "9200.11461844" + }, + { + "close": "7372.72", + "high": "7590.00", + "low": "7275.16", + "open": "7388.79", + "timestamp": "1509840000", + "volume": "9218.32689776" + }, + { + "close": "6967.68", + "high": "7421.39", + "low": "6922.07", + "open": "7373.30", + "timestamp": "1509926400", + "volume": "19323.12875746" + }, + { + "close": "7130.28", + "high": "7244.69", + "low": "6945.00", + "open": "6967.64", + "timestamp": "1510012800", + "volume": "11634.26529651" + }, + { + "close": "7450.32", + "high": "7888.00", + "low": "7080.01", + "open": "7131.38", + "timestamp": "1510099200", + "volume": "24679.72054960" + }, + { + "close": "7148.00", + "high": "7490.00", + "low": "7061.20", + "open": "7465.06", + "timestamp": "1510185600", + "volume": "14799.26577204" + }, + { + "close": "6588.18", + "high": "7343.18", + "low": "6429.44", + "open": "7150.61", + "timestamp": "1510272000", + "volume": "26614.27605231" + }, + { + "close": "6355.13", + "high": "6820.00", + "low": "6218.00", + "open": "6588.18", + "timestamp": "1510358400", + "volume": "14942.70255533" + }, + { + "close": "5870.37", + "high": "6488.88", + "low": "5555.55", + "open": "6355.13", + "timestamp": "1510444800", + "volume": "37315.15663980" + }, + { + "close": "6525.17", + "high": "6775.75", + "low": "5846.00", + "open": "5870.03", + "timestamp": "1510531200", + "volume": "27202.28180796" + }, + { + "close": "6609.00", + "high": "6750.00", + "low": "6466.88", + "open": "6524.69", + "timestamp": "1510617600", + "volume": "12072.05308804" + }, + { + "close": "7294.00", + "high": "7350.00", + "low": "6609.00", + "open": "6609.00", + "timestamp": "1510704000", + "volume": "16869.89791295" + }, + { + "close": "7846.96", + "high": "7976.79", + "low": "7120.85", + "open": "7294.00", + "timestamp": "1510790400", + "volume": "19272.37147666" + }, + { + "close": "7674.99", + "high": "7997.00", + "low": "7528.50", + "open": "7846.96", + "timestamp": "1510876800", + "volume": "17714.36787452" + }, + { + "close": "7771.03", + "high": "7858.00", + "low": "7431.54", + "open": "7675.00", + "timestamp": "1510963200", + "volume": "7326.81014016" + }, + { + "close": "8016.58", + "high": "8087.35", + "low": "7675.00", + "open": "7775.55", + "timestamp": "1511049600", + "volume": "8307.77750857" + }, + { + "close": "8226.17", + "high": "8269.99", + "low": "7900.00", + "open": "8016.58", + "timestamp": "1511136000", + "volume": "8179.45772727" + }, + { + "close": "8095.23", + "high": "8354.46", + "low": "7770.00", + "open": "8226.14", + "timestamp": "1511222400", + "volume": "13686.51123870" + }, + { + "close": "8214.69", + "high": "8310.89", + "low": "8045.76", + "open": "8095.19", + "timestamp": "1511308800", + "volume": "8078.58080138" + }, + { + "close": "7989.00", + "high": "8279.76", + "low": "7980.00", + "open": "8214.69", + "timestamp": "1511395200", + "volume": "7811.79339997" + }, + { + "close": "8199.19", + "high": "8340.00", + "low": "7876.00", + "open": "7988.96", + "timestamp": "1511481600", + "volume": "9289.98925704" + }, + { + "close": "8717.99", + "high": "8737.00", + "low": "8114.78", + "open": "8199.83", + "timestamp": "1511568000", + "volume": "11611.66637888" + }, + { + "close": "9271.06", + "high": "9366.60", + "low": "8538.20", + "open": "8718.00", + "timestamp": "1511654400", + "volume": "12021.21548696" + }, + { + "close": "9708.07", + "high": "9721.70", + "low": "9267.00", + "open": "9278.99", + "timestamp": "1511740800", + "volume": "13272.45254013" + }, + { + "close": "9868.82", + "high": "9968.00", + "low": "9582.25", + "open": "9708.06", + "timestamp": "1511827200", + "volume": "11214.92993115" + }, + { + "close": "9824.68", + "high": "11395.00", + "low": "9250.00", + "open": "9877.63", + "timestamp": "1511913600", + "volume": "33432.33996208" + }, + { + "close": "9947.67", + "high": "10618.29", + "low": "9000.00", + "open": "9833.70", + "timestamp": "1512000000", + "volume": "25433.45836367" + }, + { + "close": "10840.45", + "high": "10949.89", + "low": "9370.11", + "open": "9927.29", + "timestamp": "1512086400", + "volume": "16708.03224846" + }, + { + "close": "10872.00", + "high": "11200.00", + "low": "10637.69", + "open": "10840.45", + "timestamp": "1512172800", + "volume": "9267.16105468" + }, + { + "close": "11250.00", + "high": "11800.01", + "low": "10513.16", + "open": "10875.68", + "timestamp": "1512259200", + "volume": "14238.52587700" + }, + { + "close": "11613.07", + "high": "11613.07", + "low": "10850.00", + "open": "11250.00", + "timestamp": "1512345600", + "volume": "13621.48197282" + }, + { + "close": "11677.00", + "high": "11850.00", + "low": "11384.25", + "open": "11613.07", + "timestamp": "1512432000", + "volume": "11875.03377686" + }, + { + "close": "13623.50", + "high": "13700.00", + "low": "11659.80", + "open": "11676.99", + "timestamp": "1512518400", + "volume": "19784.87348713" + }, + { + "close": "16599.99", + "high": "16615.62", + "low": "13085.90", + "open": "13623.00", + "timestamp": "1512604800", + "volume": "25787.67655646" + }, + { + "close": "15800.00", + "high": "16666.66", + "low": "13482.42", + "open": "16599.99", + "timestamp": "1512691200", + "volume": "25473.39531065" + }, + { + "close": "14607.49", + "high": "15998.50", + "low": "12701.05", + "open": "15799.87", + "timestamp": "1512777600", + "volume": "16587.47292694" + }, + { + "close": "14691.00", + "high": "15385.00", + "low": "13011.00", + "open": "14601.01", + "timestamp": "1512864000", + "volume": "18487.98304099" + }, + { + "close": "16470.00", + "high": "17270.00", + "low": "14677.19", + "open": "14690.99", + "timestamp": "1512950400", + "volume": "16583.72315538" + }, + { + "close": "16650.01", + "high": "17428.42", + "low": "15967.29", + "open": "16470.00", + "timestamp": "1513036800", + "volume": "13517.89210328" + }, + { + "close": "16250.00", + "high": "17107.03", + "low": "15497.69", + "open": "16650.01", + "timestamp": "1513123200", + "volume": "17136.70585820" + }, + { + "close": "16404.99", + "high": "16830.45", + "low": "15852.69", + "open": "16245.02", + "timestamp": "1513209600", + "volume": "13409.52428786" + }, + { + "close": "17471.50", + "high": "17934.00", + "low": "16337.19", + "open": "16404.99", + "timestamp": "1513296000", + "volume": "18998.38813709" + }, + { + "close": "19187.78", + "high": "19377.00", + "low": "17269.99", + "open": "17477.98", + "timestamp": "1513382400", + "volume": "9761.22080853" + }, + { + "close": "18953.00", + "high": "19666.00", + "low": "18465.00", + "open": "19187.78", + "timestamp": "1513468800", + "volume": "9749.24915462" + }, + { + "close": "18940.57", + "high": "19220.00", + "low": "17835.20", + "open": "18953.00", + "timestamp": "1513555200", + "volume": "14678.94144797" + }, + { + "close": "17700.00", + "high": "19160.79", + "low": "16831.26", + "open": "18940.58", + "timestamp": "1513641600", + "volume": "21528.13766503" + }, + { + "close": "16466.98", + "high": "17950.00", + "low": "15343.04", + "open": "17700.00", + "timestamp": "1513728000", + "volume": "31172.22880670" + }, + { + "close": "15600.01", + "high": "17281.17", + "low": "15005.00", + "open": "16466.98", + "timestamp": "1513814400", + "volume": "20377.86043859" + }, + { + "close": "14009.79", + "high": "15795.61", + "low": "11159.93", + "open": "15600.00", + "timestamp": "1513900800", + "volume": "57444.88580326" + }, + { + "close": "14619.00", + "high": "15756.22", + "low": "13496.48", + "open": "13980.00", + "timestamp": "1513987200", + "volume": "21786.40866420" + }, + { + "close": "14157.87", + "high": "14619.10", + "low": "12488.00", + "open": "14619.00", + "timestamp": "1514073600", + "volume": "18519.48932254" + }, + { + "close": "13911.28", + "high": "14650.00", + "low": "13210.00", + "open": "14107.87", + "timestamp": "1514160000", + "volume": "11564.54433309" + }, + { + "close": "15764.44", + "high": "16147.87", + "low": "13746.95", + "open": "13925.50", + "timestamp": "1514246400", + "volume": "15051.16401761" + }, + { + "close": "15364.93", + "high": "16480.52", + "low": "14484.00", + "open": "15764.45", + "timestamp": "1514332800", + "volume": "15643.75488215" + }, + { + "close": "14470.07", + "high": "15474.19", + "low": "13500.00", + "open": "15390.05", + "timestamp": "1514419200", + "volume": "16557.21732271" + }, + { + "close": "14340.00", + "high": "15111.00", + "low": "13998.00", + "open": "14436.99", + "timestamp": "1514505600", + "volume": "13505.70299216" + }, + { + "close": "12640.00", + "high": "14463.28", + "low": "12050.00", + "open": "14351.00", + "timestamp": "1514592000", + "volume": "21749.67444609" + }, + { + "close": "13880.00", + "high": "14296.06", + "low": "12491.21", + "open": "12640.00", + "timestamp": "1514678400", + "volume": "11583.41864698" + }, + { + "close": "13443.41", + "high": "13941.75", + "low": "12801.38", + "open": "13880.00", + "timestamp": "1514764800", + "volume": "7688.03068460" + }, + { + "close": "14678.94", + "high": "15257.53", + "low": "12910.58", + "open": "13394.20", + "timestamp": "1514851200", + "volume": "16299.66930279" + }, + { + "close": "15155.62", + "high": "15500.00", + "low": "14546.28", + "open": "14670.96", + "timestamp": "1514937600", + "volume": "12275.00119668" + }, + { + "close": "15143.67", + "high": "15430.27", + "low": "14192.37", + "open": "15155.62", + "timestamp": "1515024000", + "volume": "15004.01859256" + }, + { + "close": "16928.00", + "high": "17200.00", + "low": "14810.00", + "open": "15143.67", + "timestamp": "1515110400", + "volume": "16248.91467956" + }, + { + "close": "17149.67", + "high": "17234.99", + "low": "16220.00", + "open": "16927.99", + "timestamp": "1515196800", + "volume": "9501.01675546" + }, + { + "close": "16124.02", + "high": "17149.97", + "low": "15707.16", + "open": "17142.43", + "timestamp": "1515283200", + "volume": "8632.81384337" + }, + { + "close": "14999.99", + "high": "16300.00", + "low": "13900.00", + "open": "16173.98", + "timestamp": "1515369600", + "volume": "16676.34994239" + }, + { + "close": "14403.51", + "high": "15367.18", + "low": "14123.97", + "open": "14999.99", + "timestamp": "1515456000", + "volume": "13913.52469368" + }, + { + "close": "14890.02", + "high": "14900.00", + "low": "13412.00", + "open": "14403.51", + "timestamp": "1515542400", + "volume": "18479.01253046" + }, + { + "close": "13243.83", + "high": "14973.07", + "low": "12800.00", + "open": "14899.99", + "timestamp": "1515628800", + "volume": "19630.07517112" + }, + { + "close": "13781.41", + "high": "14152.19", + "low": "12807.27", + "open": "13249.99", + "timestamp": "1515715200", + "volume": "13433.08481363" + }, + { + "close": "14197.78", + "high": "14619.10", + "low": "13789.42", + "open": "13829.28", + "timestamp": "1515801600", + "volume": "7488.98701847" + }, + { + "close": "13647.99", + "high": "14365.81", + "low": "13072.22", + "open": "14197.78", + "timestamp": "1515888000", + "volume": "7588.63558972" + }, + { + "close": "13607.04", + "high": "14394.36", + "low": "13429.25", + "open": "13647.99", + "timestamp": "1515974400", + "volume": "9444.63530824" + }, + { + "close": "11386.34", + "high": "13607.04", + "low": "10162.00", + "open": "13581.66", + "timestamp": "1516060800", + "volume": "38789.88308789" + }, + { + "close": "11191.35", + "high": "11794.07", + "low": "9222.00", + "open": "11393.97", + "timestamp": "1516147200", + "volume": "41356.18973790" + }, + { + "close": "11247.57", + "high": "12146.00", + "low": "10693.00", + "open": "11199.00", + "timestamp": "1516233600", + "volume": "22195.26202056" + }, + { + "close": "11552.00", + "high": "12050.39", + "low": "11025.18", + "open": "11290.90", + "timestamp": "1516320000", + "volume": "13203.25567513" + }, + { + "close": "12775.99", + "high": "13052.12", + "low": "11515.94", + "open": "11560.82", + "timestamp": "1516406400", + "volume": "10324.05733414" + }, + { + "close": "11558.87", + "high": "12791.88", + "low": "11100.00", + "open": "12782.99", + "timestamp": "1516492800", + "volume": "11596.44128787" + }, + { + "close": "10808.99", + "high": "11910.78", + "low": "10028.41", + "open": "11558.87", + "timestamp": "1516579200", + "volume": "17067.72925582" + }, + { + "close": "10851.82", + "high": "11409.87", + "low": "9927.54", + "open": "10810.00", + "timestamp": "1516665600", + "volume": "17250.17614645" + }, + { + "close": "11400.96", + "high": "11500.00", + "low": "10488.13", + "open": "10848.99", + "timestamp": "1516752000", + "volume": "11646.79059794" + }, + { + "close": "11155.54", + "high": "11741.82", + "low": "10868.57", + "open": "11400.98", + "timestamp": "1516838400", + "volume": "10212.92183381" + }, + { + "close": "11092.95", + "high": "11635.00", + "low": "10263.32", + "open": "11140.01", + "timestamp": "1516924800", + "volume": "15074.66641243" + }, + { + "close": "11446.54", + "high": "11630.47", + "low": "10815.84", + "open": "11093.74", + "timestamp": "1517011200", + "volume": "10309.80746248" + }, + { + "close": "11685.58", + "high": "11989.15", + "low": "11360.52", + "open": "11446.54", + "timestamp": "1517097600", + "volume": "9956.09249576" + }, + { + "close": "11162.62", + "high": "11820.01", + "low": "10991.00", + "open": "11685.58", + "timestamp": "1517184000", + "volume": "9996.35689848" + }, + { + "close": "9971.00", + "high": "11222.36", + "low": "9731.20", + "open": "11162.62", + "timestamp": "1517270400", + "volume": "21082.19252764" + }, + { + "close": "10149.00", + "high": "10324.00", + "low": "9514.96", + "open": "9971.00", + "timestamp": "1517356800", + "volume": "12743.50947059" + }, + { + "close": "8998.99", + "high": "10187.56", + "low": "8455.00", + "open": "10148.99", + "timestamp": "1517443200", + "volume": "26356.58883931" + }, + { + "close": "8838.83", + "high": "9096.79", + "low": "7625.25", + "open": "9010.87", + "timestamp": "1517529600", + "volume": "44406.01982931" + }, + { + "close": "9225.86", + "high": "9491.20", + "low": "8170.71", + "open": "8838.29", + "timestamp": "1517616000", + "volume": "16208.37411342" + }, + { + "close": "8191.00", + "high": "9350.09", + "low": "7825.00", + "open": "9225.31", + "timestamp": "1517702400", + "volume": "19110.67246079" + }, + { + "close": "6874.27", + "high": "8335.56", + "low": "6600.00", + "open": "8190.78", + "timestamp": "1517788800", + "volume": "46544.42880431" + }, + { + "close": "7737.37", + "high": "8150.00", + "low": "5920.72", + "open": "6878.65", + "timestamp": "1517875200", + "volume": "70961.36965826" + }, + { + "close": "7588.01", + "high": "8649.00", + "low": "7213.80", + "open": "7737.26", + "timestamp": "1517961600", + "volume": "32640.89253754" + }, + { + "close": "8259.76", + "high": "8644.36", + "low": "7565.50", + "open": "7588.01", + "timestamp": "1518048000", + "volume": "22746.39118112" + }, + { + "close": "8693.98", + "high": "8779.62", + "low": "7753.32", + "open": "8259.42", + "timestamp": "1518134400", + "volume": "18418.11709042" + }, + { + "close": "8560.00", + "high": "9090.80", + "low": "8170.86", + "open": "8693.98", + "timestamp": "1518220800", + "volume": "14670.55870203" + }, + { + "close": "8067.00", + "high": "8560.00", + "low": "7820.00", + "open": "8560.00", + "timestamp": "1518307200", + "volume": "12711.78584570" + }, + { + "close": "8899.00", + "high": "8995.00", + "low": "8067.00", + "open": "8077.25", + "timestamp": "1518393600", + "volume": "15071.04029684" + }, + { + "close": "8522.99", + "high": "8951.89", + "low": "8360.13", + "open": "8891.20", + "timestamp": "1518480000", + "volume": "11374.52415254" + }, + { + "close": "9490.98", + "high": "9515.00", + "low": "8504.57", + "open": "8504.57", + "timestamp": "1518566400", + "volume": "17468.73886593" + }, + { + "close": "10018.00", + "high": "10234.00", + "low": "9350.00", + "open": "9490.98", + "timestamp": "1518652800", + "volume": "21036.33731750" + }, + { + "close": "10196.00", + "high": "10300.00", + "low": "9707.51", + "open": "10011.30", + "timestamp": "1518739200", + "volume": "11857.64277513" + }, + { + "close": "11101.00", + "high": "11135.83", + "low": "10053.50", + "open": "10203.14", + "timestamp": "1518825600", + "volume": "14511.16913676" + }, + { + "close": "10421.06", + "high": "11300.00", + "low": "10153.15", + "open": "11101.00", + "timestamp": "1518912000", + "volume": "17623.07943135" + }, + { + "close": "11173.00", + "high": "11262.48", + "low": "10307.51", + "open": "10433.68", + "timestamp": "1518998400", + "volume": "11698.25622611" + }, + { + "close": "11233.41", + "high": "11780.00", + "low": "11080.37", + "open": "11159.12", + "timestamp": "1519084800", + "volume": "15880.90903980" + }, + { + "close": "10449.40", + "high": "11275.74", + "low": "10256.00", + "open": "11233.42", + "timestamp": "1519171200", + "volume": "19959.67715652" + }, + { + "close": "9843.34", + "high": "10935.00", + "low": "9731.20", + "open": "10446.79", + "timestamp": "1519257600", + "volume": "20204.69095384" + }, + { + "close": "10166.10", + "high": "10405.30", + "low": "9600.00", + "open": "9843.33", + "timestamp": "1519344000", + "volume": "16044.03930333" + }, + { + "close": "9689.99", + "high": "10540.63", + "low": "9373.48", + "open": "10135.20", + "timestamp": "1519430400", + "volume": "13972.71472351" + }, + { + "close": "9590.04", + "high": "9883.41", + "low": "9260.00", + "open": "9688.26", + "timestamp": "1519516800", + "volume": "11037.17695269" + }, + { + "close": "10324.70", + "high": "10461.97", + "low": "9376.34", + "open": "9595.99", + "timestamp": "1519603200", + "volume": "16156.80505618" + }, + { + "close": "10566.30", + "high": "10850.00", + "low": "10150.00", + "open": "10329.99", + "timestamp": "1519689600", + "volume": "10408.47993775" + }, + { + "close": "10314.90", + "high": "11064.75", + "low": "10255.07", + "open": "10572.49", + "timestamp": "1519776000", + "volume": "10490.74905816" + }, + { + "close": "10903.13", + "high": "11090.00", + "low": "10223.41", + "open": "10314.99", + "timestamp": "1519862400", + "volume": "9481.66514611" + }, + { + "close": "11029.99", + "high": "11175.00", + "low": "10774.01", + "open": "10917.37", + "timestamp": "1519948800", + "volume": "8329.09790086" + }, + { + "close": "11445.00", + "high": "11503.24", + "low": "11022.85", + "open": "11032.81", + "timestamp": "1520035200", + "volume": "7786.26753951" + }, + { + "close": "11463.27", + "high": "11511.00", + "low": "11054.91", + "open": "11445.00", + "timestamp": "1520121600", + "volume": "6831.63070279" + }, + { + "close": "11419.24", + "high": "11688.00", + "low": "11383.66", + "open": "11479.68", + "timestamp": "1520208000", + "volume": "9933.67623336" + }, + { + "close": "10723.76", + "high": "11420.01", + "low": "10560.19", + "open": "11417.39", + "timestamp": "1520294400", + "volume": "14734.41949313" + }, + { + "close": "9913.03", + "high": "10911.78", + "low": "9450.00", + "open": "10723.01", + "timestamp": "1520380800", + "volume": "26116.51184803" + }, + { + "close": "9285.32", + "high": "10150.00", + "low": "9078.95", + "open": "9904.52", + "timestamp": "1520467200", + "volume": "22522.42746991" + }, + { + "close": "9230.00", + "high": "9420.39", + "low": "8366.00", + "open": "9293.06", + "timestamp": "1520553600", + "volume": "29014.16684454" + }, + { + "close": "8791.47", + "high": "9514.96", + "low": "8697.00", + "open": "9228.83", + "timestamp": "1520640000", + "volume": "12886.58857926" + }, + { + "close": "9535.04", + "high": "9768.37", + "low": "8450.00", + "open": "8795.04", + "timestamp": "1520726400", + "volume": "16407.54237557" + }, + { + "close": "9120.75", + "high": "9892.00", + "low": "8742.07", + "open": "9535.04", + "timestamp": "1520812800", + "volume": "18751.02057959" + }, + { + "close": "9142.32", + "high": "9482.79", + "low": "8830.00", + "open": "9115.24", + "timestamp": "1520899200", + "volume": "16001.47534639" + }, + { + "close": "8196.69", + "high": "9356.14", + "low": "7948.00", + "open": "9152.07", + "timestamp": "1520985600", + "volume": "21191.02313580" + }, + { + "close": "8265.05", + "high": "8425.00", + "low": "7682.00", + "open": "8195.99", + "timestamp": "1521072000", + "volume": "18387.61138793" + }, + { + "close": "8258.54", + "high": "8613.06", + "low": "7914.08", + "open": "8265.05", + "timestamp": "1521158400", + "volume": "16498.62433531" + }, + { + "close": "7860.83", + "high": "8356.40", + "low": "7730.23", + "open": "8258.54", + "timestamp": "1521244800", + "volume": "12048.66889140" + }, + { + "close": "8188.24", + "high": "8324.92", + "low": "7325.37", + "open": "7860.83", + "timestamp": "1521331200", + "volume": "19547.36114711" + }, + { + "close": "8596.93", + "high": "8718.74", + "low": "8114.17", + "open": "8205.55", + "timestamp": "1521417600", + "volume": "19396.08835883" + }, + { + "close": "8904.02", + "high": "9051.00", + "low": "8313.01", + "open": "8596.79", + "timestamp": "1521504000", + "volume": "13454.82226040" + }, + { + "close": "8893.79", + "high": "9188.10", + "low": "8754.83", + "open": "8904.02", + "timestamp": "1521590400", + "volume": "12100.99713332" + }, + { + "close": "8704.67", + "high": "9099.59", + "low": "8503.52", + "open": "8892.18", + "timestamp": "1521676800", + "volume": "12587.63392229" + }, + { + "close": "8920.79", + "high": "8920.79", + "low": "8265.00", + "open": "8708.52", + "timestamp": "1521763200", + "volume": "13749.78486097" + }, + { + "close": "8547.00", + "high": "9020.00", + "low": "8505.00", + "open": "8917.99", + "timestamp": "1521849600", + "volume": "9731.98236841" + }, + { + "close": "8453.90", + "high": "8680.00", + "low": "8368.63", + "open": "8541.96", + "timestamp": "1521936000", + "volume": "9155.91214778" + }, + { + "close": "8149.66", + "high": "8500.00", + "low": "7831.15", + "open": "8451.12", + "timestamp": "1522022400", + "volume": "17693.41533930" + }, + { + "close": "7791.70", + "high": "8211.62", + "low": "7742.11", + "open": "8152.26", + "timestamp": "1522108800", + "volume": "12385.25028422" + }, + { + "close": "7932.41", + "high": "8104.98", + "low": "7723.03", + "open": "7791.69", + "timestamp": "1522195200", + "volume": "8437.64467971" + }, + { + "close": "7088.38", + "high": "7968.00", + "low": "6914.53", + "open": "7932.41", + "timestamp": "1522281600", + "volume": "22138.11413228" + }, + { + "close": "6850.00", + "high": "7302.35", + "low": "6550.00", + "open": "7086.14", + "timestamp": "1522368000", + "volume": "29101.44802706" + }, + { + "close": "6928.62", + "high": "7231.73", + "low": "6794.26", + "open": "6839.63", + "timestamp": "1522454400", + "volume": "11579.59705718" + }, + { + "close": "6813.52", + "high": "7045.71", + "low": "6427.16", + "open": "6926.50", + "timestamp": "1522540800", + "volume": "18046.94087395" + }, + { + "close": "7052.76", + "high": "7106.50", + "low": "6759.96", + "open": "6816.31", + "timestamp": "1522627200", + "volume": "13624.16035566" + }, + { + "close": "7416.27", + "high": "7506.84", + "low": "7001.28", + "open": "7052.75", + "timestamp": "1522713600", + "volume": "16089.54162903" + }, + { + "close": "6799.95", + "high": "7430.00", + "low": "6710.38", + "open": "7415.53", + "timestamp": "1522800000", + "volume": "15779.20246661" + }, + { + "close": "6771.69", + "high": "6928.70", + "low": "6578.95", + "open": "6799.37", + "timestamp": "1522886400", + "volume": "11894.53597807" + }, + { + "close": "6618.33", + "high": "6850.00", + "low": "6510.00", + "open": "6771.30", + "timestamp": "1522972800", + "volume": "8478.41806897" + }, + { + "close": "6904.90", + "high": "7069.13", + "low": "6600.99", + "open": "6627.70", + "timestamp": "1523059200", + "volume": "7683.04165260" + }, + { + "close": "7027.26", + "high": "7104.52", + "low": "6894.80", + "open": "6904.21", + "timestamp": "1523145600", + "volume": "4352.69794202" + }, + { + "close": "6780.10", + "high": "7175.83", + "low": "6611.49", + "open": "7027.26", + "timestamp": "1523232000", + "volume": "10103.91621615" + }, + { + "close": "6835.67", + "high": "6900.00", + "low": "6653.21", + "open": "6782.39", + "timestamp": "1523318400", + "volume": "6480.19276418" + }, + { + "close": "6940.94", + "high": "6984.92", + "low": "6809.26", + "open": "6824.75", + "timestamp": "1523404800", + "volume": "5825.41064556" + }, + { + "close": "7923.78", + "high": "8069.34", + "low": "6758.45", + "open": "6940.94", + "timestamp": "1523491200", + "volume": "19033.38033440" + }, + { + "close": "7896.92", + "high": "8239.33", + "low": "7753.32", + "open": "7923.78", + "timestamp": "1523577600", + "volume": "19605.94275077" + }, + { + "close": "8000.41", + "high": "8232.14", + "low": "7835.00", + "open": "7885.90", + "timestamp": "1523664000", + "volume": "8935.53071477" + }, + { + "close": "8354.22", + "high": "8417.00", + "low": "8001.23", + "open": "8003.39", + "timestamp": "1523750400", + "volume": "7542.84081564" + }, + { + "close": "8048.15", + "high": "8424.99", + "low": "7905.00", + "open": "8353.43", + "timestamp": "1523836800", + "volume": "10866.60295749" + }, + { + "close": "7890.87", + "high": "8160.85", + "low": "7806.81", + "open": "8054.68", + "timestamp": "1523923200", + "volume": "9277.15121538" + }, + { + "close": "8172.84", + "high": "8235.00", + "low": "7870.35", + "open": "7890.87", + "timestamp": "1524009600", + "volume": "9227.20459808" + }, + { + "close": "8271.31", + "high": "8297.99", + "low": "8074.44", + "open": "8172.83", + "timestamp": "1524096000", + "volume": "9436.84632763" + }, + { + "close": "8861.00", + "high": "8934.00", + "low": "8216.90", + "open": "8273.00", + "timestamp": "1524182400", + "volume": "16059.62267134" + }, + { + "close": "8920.71", + "high": "9023.40", + "low": "8608.00", + "open": "8865.78", + "timestamp": "1524268800", + "volume": "15336.30792743" + }, + { + "close": "8789.96", + "high": "9036.52", + "low": "8760.00", + "open": "8924.93", + "timestamp": "1524355200", + "volume": "9346.45175925" + }, + { + "close": "8946.95", + "high": "9006.39", + "low": "8771.22", + "open": "8781.70", + "timestamp": "1524441600", + "volume": "10286.11771490" + }, + { + "close": "9648.00", + "high": "9737.16", + "low": "8930.00", + "open": "8942.00", + "timestamp": "1524528000", + "volume": "20460.50898304" + }, + { + "close": "8864.99", + "high": "9755.53", + "low": "8751.00", + "open": "9648.36", + "timestamp": "1524614400", + "volume": "33035.90404482" + }, + { + "close": "9274.48", + "high": "9326.79", + "low": "8647.29", + "open": "8855.07", + "timestamp": "1524700800", + "volume": "20042.96970211" + }, + { + "close": "8921.43", + "high": "9387.82", + "low": "8901.09", + "open": "9277.32", + "timestamp": "1524787200", + "volume": "11375.51437547" + }, + { + "close": "9345.11", + "high": "9442.34", + "low": "8854.47", + "open": "8916.54", + "timestamp": "1524873600", + "volume": "15558.40230193" + }, + { + "close": "9393.99", + "high": "9538.75", + "low": "9180.00", + "open": "9352.97", + "timestamp": "1524960000", + "volume": "10940.71803063" + }, + { + "close": "9242.17", + "high": "9443.96", + "low": "9111.00", + "open": "9396.32", + "timestamp": "1525046400", + "volume": "8085.68829456" + }, + { + "close": "9066.90", + "high": "9249.99", + "low": "8815.91", + "open": "9243.51", + "timestamp": "1525132800", + "volume": "12138.26396050" + }, + { + "close": "9222.00", + "high": "9259.16", + "low": "8975.23", + "open": "9066.90", + "timestamp": "1525219200", + "volume": "10575.17497792" + }, + { + "close": "9732.43", + "high": "9799.99", + "low": "9165.19", + "open": "9220.00", + "timestamp": "1525305600", + "volume": "11670.79957863" + }, + { + "close": "9696.57", + "high": "9784.73", + "low": "9527.38", + "open": "9737.00", + "timestamp": "1525392000", + "volume": "7326.05207111" + }, + { + "close": "9823.28", + "high": "9948.98", + "low": "9670.68", + "open": "9689.00", + "timestamp": "1525478400", + "volume": "7403.10502352" + }, + { + "close": "9623.54", + "high": "9918.41", + "low": "9375.00", + "open": "9827.04", + "timestamp": "1525564800", + "volume": "8155.57685660" + }, + { + "close": "9359.52", + "high": "9634.50", + "low": "9175.00", + "open": "9621.99", + "timestamp": "1525651200", + "volume": "13616.34859330" + }, + { + "close": "9167.69", + "high": "9450.00", + "low": "9015.00", + "open": "9356.79", + "timestamp": "1525737600", + "volume": "11418.31053651" + }, + { + "close": "9308.49", + "high": "9368.79", + "low": "8974.62", + "open": "9181.52", + "timestamp": "1525824000", + "volume": "11368.83432539" + }, + { + "close": "9020.99", + "high": "9393.00", + "low": "8987.74", + "open": "9308.49", + "timestamp": "1525910400", + "volume": "11764.97750570" + }, + { + "close": "8411.42", + "high": "9018.38", + "low": "8351.00", + "open": "9007.19", + "timestamp": "1525996800", + "volume": "20383.92660992" + }, + { + "close": "8481.60", + "high": "8652.80", + "low": "8208.81", + "open": "8408.79", + "timestamp": "1526083200", + "volume": "15464.92940302" + }, + { + "close": "8696.58", + "high": "8775.90", + "low": "8335.56", + "open": "8481.72", + "timestamp": "1526169600", + "volume": "9835.22450915" + }, + { + "close": "8674.36", + "high": "8900.90", + "low": "8286.57", + "open": "8696.54", + "timestamp": "1526256000", + "volume": "18861.93709627" + }, + { + "close": "8474.99", + "high": "8865.00", + "low": "8400.00", + "open": "8674.53", + "timestamp": "1526342400", + "volume": "12391.83198691" + }, + { + "close": "8346.59", + "high": "8505.33", + "low": "8100.01", + "open": "8481.99", + "timestamp": "1526428800", + "volume": "12705.12321984" + }, + { + "close": "8067.03", + "high": "8500.00", + "low": "7980.00", + "open": "8337.77", + "timestamp": "1526515200", + "volume": "8259.12452442" + }, + { + "close": "8248.87", + "high": "8275.10", + "low": "7929.53", + "open": "8058.16", + "timestamp": "1526601600", + "volume": "7181.20388348" + }, + { + "close": "8231.20", + "high": "8395.00", + "low": "8141.08", + "open": "8248.99", + "timestamp": "1526688000", + "volume": "3784.07576637" + }, + { + "close": "8518.48", + "high": "8590.00", + "low": "8170.71", + "open": "8225.55", + "timestamp": "1526774400", + "volume": "5314.99889979" + }, + { + "close": "8391.76", + "high": "8589.10", + "low": "8320.00", + "open": "8518.64", + "timestamp": "1526860800", + "volume": "6126.97105348" + }, + { + "close": "7984.08", + "high": "8417.65", + "low": "7951.41", + "open": "8403.23", + "timestamp": "1526947200", + "volume": "9101.06078693" + }, + { + "close": "7502.89", + "high": "8032.01", + "low": "7435.49", + "open": "7983.98", + "timestamp": "1527033600", + "volume": "17635.90129337" + }, + { + "close": "7586.88", + "high": "7733.99", + "low": "7267.24", + "open": "7509.99", + "timestamp": "1527120000", + "volume": "11648.36524358" + }, + { + "close": "7471.18", + "high": "7661.07", + "low": "7328.13", + "open": "7579.30", + "timestamp": "1527206400", + "volume": "10088.84331121" + }, + { + "close": "7335.99", + "high": "7622.87", + "low": "7276.04", + "open": "7459.21", + "timestamp": "1527292800", + "volume": "4043.55765023" + }, + { + "close": "7347.39", + "high": "7412.57", + "low": "7213.09", + "open": "7335.99", + "timestamp": "1527379200", + "volume": "3144.45110906" + }, + { + "close": "7112.50", + "high": "7445.00", + "low": "7084.99", + "open": "7348.64", + "timestamp": "1527465600", + "volume": "6583.63252959" + }, + { + "close": "7469.45", + "high": "7537.00", + "low": "7026.90", + "open": "7112.20", + "timestamp": "1527552000", + "volume": "11049.92099287" + }, + { + "close": "7375.73", + "high": "7559.00", + "low": "7273.89", + "open": "7469.45", + "timestamp": "1527638400", + "volume": "8940.45400530" + }, + { + "close": "7492.28", + "high": "7601.23", + "low": "7330.22", + "open": "7375.64", + "timestamp": "1527724800", + "volume": "7339.00726931" + }, + { + "close": "7511.60", + "high": "7620.01", + "low": "7348.45", + "open": "7492.28", + "timestamp": "1527811200", + "volume": "6762.62757270" + }, + { + "close": "7642.00", + "high": "7700.00", + "low": "7438.92", + "open": "7511.72", + "timestamp": "1527897600", + "volume": "4012.16875521" + }, + { + "close": "7703.67", + "high": "7790.69", + "low": "7581.03", + "open": "7642.00", + "timestamp": "1527984000", + "volume": "4729.21008365" + }, + { + "close": "7488.26", + "high": "7764.44", + "low": "7449.68", + "open": "7712.97", + "timestamp": "1528070400", + "volume": "6990.55135270" + }, + { + "close": "7617.98", + "high": "7685.00", + "low": "7360.00", + "open": "7494.99", + "timestamp": "1528156800", + "volume": "9968.45508961" + }, + { + "close": "7658.57", + "high": "7695.46", + "low": "7482.61", + "open": "7617.98", + "timestamp": "1528243200", + "volume": "7058.05577232" + }, + { + "close": "7689.28", + "high": "7750.00", + "low": "7618.99", + "open": "7658.99", + "timestamp": "1528329600", + "volume": "7545.00925066" + }, + { + "close": "7618.11", + "high": "7697.00", + "low": "7542.00", + "open": "7676.41", + "timestamp": "1528416000", + "volume": "4676.55832777" + }, + { + "close": "7492.70", + "high": "7686.45", + "low": "7468.31", + "open": "7618.11", + "timestamp": "1528502400", + "volume": "2713.78104511" + }, + { + "close": "6781.17", + "high": "7498.00", + "low": "6627.70", + "open": "7498.00", + "timestamp": "1528588800", + "volume": "14392.69540615" + }, + { + "close": "6880.61", + "high": "6919.97", + "low": "6634.86", + "open": "6781.17", + "timestamp": "1528675200", + "volume": "11409.52423218" + }, + { + "close": "6557.67", + "high": "6880.76", + "low": "6461.42", + "open": "6880.76", + "timestamp": "1528761600", + "volume": "8827.59949970" + }, + { + "close": "6307.40", + "high": "6624.45", + "low": "6120.00", + "open": "6557.66", + "timestamp": "1528848000", + "volume": "19190.50457858" + }, + { + "close": "6646.10", + "high": "6708.10", + "low": "6270.69", + "open": "6308.49", + "timestamp": "1528934400", + "volume": "14185.83821156" + }, + { + "close": "6390.60", + "high": "6666.66", + "low": "6370.00", + "open": "6638.80", + "timestamp": "1529020800", + "volume": "7132.20678871" + }, + { + "close": "6487.92", + "high": "6557.81", + "low": "6333.63", + "open": "6390.60", + "timestamp": "1529107200", + "volume": "3553.69972603" + }, + { + "close": "6453.41", + "high": "6575.35", + "low": "6429.23", + "open": "6487.92", + "timestamp": "1529193600", + "volume": "2828.75680848" + }, + { + "close": "6707.50", + "high": "6793.00", + "low": "6381.25", + "open": "6451.03", + "timestamp": "1529280000", + "volume": "5940.17439750" + }, + { + "close": "6736.52", + "high": "6841.81", + "low": "6660.21", + "open": "6711.30", + "timestamp": "1529366400", + "volume": "5443.67979628" + }, + { + "close": "6756.58", + "high": "6809.26", + "low": "6558.95", + "open": "6728.44", + "timestamp": "1529452800", + "volume": "5193.76884592" + }, + { + "close": "6718.33", + "high": "6792.20", + "low": "6677.85", + "open": "6756.60", + "timestamp": "1529539200", + "volume": "4837.32442832" + }, + { + "close": "6050.45", + "high": "6737.97", + "low": "5940.00", + "open": "6718.33", + "timestamp": "1529625600", + "volume": "18544.14405465" + }, + { + "close": "6177.38", + "high": "6261.00", + "low": "6048.54", + "open": "6055.17", + "timestamp": "1529712000", + "volume": "4585.87147205" + }, + { + "close": "6153.40", + "high": "6255.05", + "low": "5780.00", + "open": "6169.91", + "timestamp": "1529798400", + "volume": "11423.59392896" + }, + { + "close": "6253.61", + "high": "6365.34", + "low": "6075.01", + "open": "6153.60", + "timestamp": "1529884800", + "volume": "9689.68930701" + }, + { + "close": "6068.00", + "high": "6277.00", + "low": "6025.68", + "open": "6252.28", + "timestamp": "1529971200", + "volume": "7751.62208792" + }, + { + "close": "6135.64", + "high": "6181.11", + "low": "5985.00", + "open": "6073.99", + "timestamp": "1530057600", + "volume": "7446.86155074" + }, + { + "close": "5848.33", + "high": "6165.49", + "low": "5818.14", + "open": "6135.64", + "timestamp": "1530144000", + "volume": "8878.39857291" + }, + { + "close": "6204.24", + "high": "6299.00", + "low": "5774.72", + "open": "5845.20", + "timestamp": "1530230400", + "volume": "12067.37316767" + }, + { + "close": "6385.71", + "high": "6510.00", + "low": "6190.28", + "open": "6204.01", + "timestamp": "1530316800", + "volume": "6915.08887702" + }, + { + "close": "6349.99", + "high": "6438.55", + "low": "6259.34", + "open": "6385.75", + "timestamp": "1530403200", + "volume": "4160.70556721" + }, + { + "close": "6612.98", + "high": "6667.57", + "low": "6270.69", + "open": "6345.48", + "timestamp": "1530489600", + "volume": "8799.80247408" + }, + { + "close": "6507.99", + "high": "6666.00", + "low": "6464.39", + "open": "6605.46", + "timestamp": "1530576000", + "volume": "5924.86541706" + }, + { + "close": "6584.25", + "high": "6792.28", + "low": "6413.20", + "open": "6507.99", + "timestamp": "1530662400", + "volume": "6706.73400620" + }, + { + "close": "6533.69", + "high": "6700.00", + "low": "6445.31", + "open": "6575.62", + "timestamp": "1530748800", + "volume": "7692.21577694" + }, + { + "close": "6596.53", + "high": "6636.15", + "low": "6449.76", + "open": "6533.69", + "timestamp": "1530835200", + "volume": "5457.67218749" + }, + { + "close": "6759.99", + "high": "6820.00", + "low": "6510.00", + "open": "6604.74", + "timestamp": "1530921600", + "volume": "4842.79587112" + }, + { + "close": "6706.60", + "high": "6783.54", + "low": "6674.60", + "open": "6755.46", + "timestamp": "1531008000", + "volume": "5145.84575684" + }, + { + "close": "6666.75", + "high": "6814.72", + "low": "6620.00", + "open": "6706.60", + "timestamp": "1531094400", + "volume": "7165.21723333" + }, + { + "close": "6299.46", + "high": "6683.90", + "low": "6270.84", + "open": "6666.75", + "timestamp": "1531180800", + "volume": "9163.01977492" + }, + { + "close": "6380.00", + "high": "6400.00", + "low": "6285.00", + "open": "6304.45", + "timestamp": "1531267200", + "volume": "6370.13680136" + }, + { + "close": "6243.88", + "high": "6380.00", + "low": "6072.00", + "open": "6379.13", + "timestamp": "1531353600", + "volume": "7792.46685782" + }, + { + "close": "6215.59", + "high": "6337.25", + "low": "6121.01", + "open": "6243.53", + "timestamp": "1531440000", + "volume": "5901.29571452" + }, + { + "close": "6243.98", + "high": "6317.84", + "low": "6180.00", + "open": "6208.78", + "timestamp": "1531526400", + "volume": "2584.73396230" + }, + { + "close": "6349.30", + "high": "6397.21", + "low": "6227.76", + "open": "6245.99", + "timestamp": "1531612800", + "volume": "3556.29310719" + }, + { + "close": "6721.04", + "high": "6755.00", + "low": "6333.63", + "open": "6353.25", + "timestamp": "1531699200", + "volume": "9404.05647649" + }, + { + "close": "7310.71", + "high": "7468.31", + "low": "6657.95", + "open": "6721.21", + "timestamp": "1531785600", + "volume": "12703.29651293" + }, + { + "close": "7378.10", + "high": "7599.98", + "low": "7239.15", + "open": "7310.71", + "timestamp": "1531872000", + "volume": "13347.87429603" + }, + { + "close": "7471.42", + "high": "7570.90", + "low": "7278.84", + "open": "7384.92", + "timestamp": "1531958400", + "volume": "8803.25309749" + }, + { + "close": "7330.84", + "high": "7696.88", + "low": "7265.00", + "open": "7474.35", + "timestamp": "1532044800", + "volume": "9379.17143244" + }, + { + "close": "7409.92", + "high": "7458.00", + "low": "7212.00", + "open": "7330.84", + "timestamp": "1532131200", + "volume": "4049.81022253" + }, + { + "close": "7396.60", + "high": "7581.03", + "low": "7336.15", + "open": "7398.16", + "timestamp": "1532217600", + "volume": "5107.97881280" + }, + { + "close": "7719.62", + "high": "7800.00", + "low": "7369.86", + "open": "7393.50", + "timestamp": "1532304000", + "volume": "12572.45317131" + }, + { + "close": "8403.83", + "high": "8496.96", + "low": "7691.14", + "open": "7712.46", + "timestamp": "1532390400", + "volume": "18707.41156484" + }, + { + "close": "8174.06", + "high": "8475.00", + "low": "8049.22", + "open": "8394.48", + "timestamp": "1532476800", + "volume": "10348.06857767" + }, + { + "close": "7926.00", + "high": "8314.23", + "low": "7855.97", + "open": "8174.06", + "timestamp": "1532563200", + "volume": "8091.87166049" + }, + { + "close": "8183.05", + "high": "8274.98", + "low": "7798.48", + "open": "7926.00", + "timestamp": "1532649600", + "volume": "8701.76587806" + }, + { + "close": "8237.74", + "high": "8259.00", + "low": "8051.43", + "open": "8177.72", + "timestamp": "1532736000", + "volume": "2765.68049060" + }, + { + "close": "8216.74", + "high": "8299.99", + "low": "8109.74", + "open": "8231.07", + "timestamp": "1532822400", + "volume": "3980.27940760" + }, + { + "close": "8160.21", + "high": "8295.00", + "low": "7853.01", + "open": "8216.74", + "timestamp": "1532908800", + "volume": "11785.89207823" + }, + { + "close": "7725.43", + "high": "8162.37", + "low": "7633.67", + "open": "8162.28", + "timestamp": "1532995200", + "volume": "11994.08614156" + }, + { + "close": "7602.01", + "high": "7761.56", + "low": "7440.00", + "open": "7726.85", + "timestamp": "1533081600", + "volume": "11406.76843741" + }, + { + "close": "7536.37", + "high": "7709.98", + "low": "7455.00", + "open": "7600.22", + "timestamp": "1533168000", + "volume": "5262.23613199" + }, + { + "close": "7416.98", + "high": "7542.92", + "low": "7286.41", + "open": "7535.00", + "timestamp": "1533254400", + "volume": "9585.77930917" + }, + { + "close": "7009.99", + "high": "7494.48", + "low": "6926.00", + "open": "7416.98", + "timestamp": "1533340800", + "volume": "6831.75139028" + }, + { + "close": "7032.61", + "high": "7086.80", + "low": "6888.88", + "open": "7009.94", + "timestamp": "1533427200", + "volume": "6039.13514460" + }, + { + "close": "6936.11", + "high": "7157.93", + "low": "6835.06", + "open": "7028.89", + "timestamp": "1533513600", + "volume": "7317.64296455" + }, + { + "close": "6717.68", + "high": "7155.00", + "low": "6671.00", + "open": "6932.18", + "timestamp": "1533600000", + "volume": "10039.39296375" + }, + { + "close": "6283.59", + "high": "6717.68", + "low": "6121.00", + "open": "6717.67", + "timestamp": "1533686400", + "volume": "14668.56802221" + }, + { + "close": "6543.76", + "high": "6627.00", + "low": "6190.01", + "open": "6283.89", + "timestamp": "1533772800", + "volume": "9484.88670496" + }, + { + "close": "6139.99", + "high": "6584.05", + "low": "5995.75", + "open": "6544.98", + "timestamp": "1533859200", + "volume": "14096.00988894" + }, + { + "close": "6239.98", + "high": "6494.13", + "low": "6000.00", + "open": "6139.99", + "timestamp": "1533945600", + "volume": "6818.37504816" + }, + { + "close": "6310.82", + "high": "6493.77", + "low": "6163.44", + "open": "6240.49", + "timestamp": "1534032000", + "volume": "7169.89323056" + }, + { + "close": "6252.63", + "high": "6544.37", + "low": "6142.20", + "open": "6311.99", + "timestamp": "1534118400", + "volume": "8896.68083746" + }, + { + "close": "6193.62", + "high": "6254.02", + "low": "5880.00", + "open": "6252.63", + "timestamp": "1534204800", + "volume": "14235.27018218" + }, + { + "close": "6272.30", + "high": "6628.50", + "low": "6186.02", + "open": "6194.30", + "timestamp": "1534291200", + "volume": "12501.11334781" + }, + { + "close": "6313.51", + "high": "6477.57", + "low": "6208.37", + "open": "6273.34", + "timestamp": "1534377600", + "volume": "7099.26116360" + }, + { + "close": "6580.15", + "high": "6584.49", + "low": "6290.64", + "open": "6314.08", + "timestamp": "1534464000", + "volume": "6635.58158998" + }, + { + "close": "6399.28", + "high": "6615.00", + "low": "6303.00", + "open": "6578.13", + "timestamp": "1534550400", + "volume": "3496.80232127" + }, + { + "close": "6481.99", + "high": "6545.00", + "low": "6312.00", + "open": "6397.37", + "timestamp": "1534636800", + "volume": "3138.71131829" + }, + { + "close": "6260.82", + "high": "6522.99", + "low": "6223.90", + "open": "6481.63", + "timestamp": "1534723200", + "volume": "6254.82080784" + }, + { + "close": "6479.27", + "high": "6513.28", + "low": "6246.05", + "open": "6260.83", + "timestamp": "1534809600", + "volume": "5655.04172504" + }, + { + "close": "6355.76", + "high": "6906.81", + "low": "6250.00", + "open": "6478.99", + "timestamp": "1534896000", + "volume": "11955.65069577" + }, + { + "close": "6525.01", + "high": "6575.99", + "low": "6344.80", + "open": "6355.97", + "timestamp": "1534982400", + "volume": "4028.43387247" + }, + { + "close": "6692.94", + "high": "6721.09", + "low": "6445.32", + "open": "6525.99", + "timestamp": "1535068800", + "volume": "6374.54257854" + }, + { + "close": "6732.40", + "high": "6800.00", + "low": "6664.25", + "open": "6692.99", + "timestamp": "1535155200", + "volume": "4980.64928331" + }, + { + "close": "6700.46", + "high": "6775.34", + "low": "6558.95", + "open": "6732.99", + "timestamp": "1535241600", + "volume": "3475.72024960" + }, + { + "close": "6904.51", + "high": "6944.47", + "low": "6641.35", + "open": "6700.13", + "timestamp": "1535328000", + "volume": "5863.68824836" + }, + { + "close": "7080.94", + "high": "7125.28", + "low": "6861.17", + "open": "6911.70", + "timestamp": "1535414400", + "volume": "8222.24765235" + }, + { + "close": "7032.96", + "high": "7124.06", + "low": "6890.00", + "open": "7079.46", + "timestamp": "1535500800", + "volume": "5730.97892652" + }, + { + "close": "6984.01", + "high": "7055.97", + "low": "6792.85", + "open": "7034.47", + "timestamp": "1535587200", + "volume": "6875.26197217" + }, + { + "close": "7017.35", + "high": "7101.03", + "low": "6879.00", + "open": "6984.34", + "timestamp": "1535673600", + "volume": "5790.38050638" + }, + { + "close": "7185.01", + "high": "7300.18", + "low": "7015.22", + "open": "7015.78", + "timestamp": "1535760000", + "volume": "4590.45724112" + }, + { + "close": "7290.31", + "high": "7334.50", + "low": "7130.63", + "open": "7195.80", + "timestamp": "1535846400", + "volume": "3297.68658519" + }, + { + "close": "7258.99", + "high": "7340.08", + "low": "7184.00", + "open": "7291.94", + "timestamp": "1535932800", + "volume": "2829.87707292" + }, + { + "close": "7361.00", + "high": "7411.85", + "low": "7231.00", + "open": "7261.29", + "timestamp": "1536019200", + "volume": "4531.14780379" + }, + { + "close": "6679.30", + "high": "7387.00", + "low": "6650.00", + "open": "7353.48", + "timestamp": "1536105600", + "volume": "12408.79698551" + }, + { + "close": "6493.09", + "high": "6705.59", + "low": "6253.29", + "open": "6671.95", + "timestamp": "1536192000", + "volume": "14674.02367160" + }, + { + "close": "6400.00", + "high": "6525.00", + "low": "6322.00", + "open": "6488.01", + "timestamp": "1536278400", + "volume": "6541.96747088" + }, + { + "close": "6178.31", + "high": "6465.46", + "low": "6113.23", + "open": "6401.01", + "timestamp": "1536364800", + "volume": "4284.19484304" + }, + { + "close": "6236.04", + "high": "6451.51", + "low": "6094.38", + "open": "6178.31", + "timestamp": "1536451200", + "volume": "4104.31379555" + }, + { + "close": "6301.99", + "high": "6351.13", + "low": "6223.90", + "open": "6238.99", + "timestamp": "1536537600", + "volume": "5371.72530672" + }, + { + "close": "6279.99", + "high": "6405.00", + "low": "6162.06", + "open": "6303.99", + "timestamp": "1536624000", + "volume": "7076.79725968" + }, + { + "close": "6322.45", + "high": "6350.00", + "low": "6192.89", + "open": "6274.60", + "timestamp": "1536710400", + "volume": "4282.15960066" + }, + { + "close": "6485.70", + "high": "6537.46", + "low": "6324.37", + "open": "6326.83", + "timestamp": "1536796800", + "volume": "6985.34747474" + }, + { + "close": "6476.51", + "high": "6587.00", + "low": "6384.36", + "open": "6482.95", + "timestamp": "1536883200", + "volume": "4598.02098322" + }, + { + "close": "6520.15", + "high": "6570.10", + "low": "6466.74", + "open": "6476.51", + "timestamp": "1536969600", + "volume": "1328.81956289" + }, + { + "close": "6499.98", + "high": "6524.84", + "low": "6349.47", + "open": "6521.49", + "timestamp": "1537056000", + "volume": "1098.62806031" + }, + { + "close": "6254.52", + "high": "6530.24", + "low": "6200.00", + "open": "6499.28", + "timestamp": "1537142400", + "volume": "4386.88772482" + }, + { + "close": "6332.34", + "high": "6390.00", + "low": "6226.63", + "open": "6251.49", + "timestamp": "1537228800", + "volume": "4196.47314808" + }, + { + "close": "6388.40", + "high": "6510.00", + "low": "6100.00", + "open": "6330.00", + "timestamp": "1537315200", + "volume": "7232.08338006" + }, + { + "close": "6492.98", + "high": "6535.11", + "low": "6333.63", + "open": "6388.40", + "timestamp": "1537401600", + "volume": "5177.64510387" + }, + { + "close": "6749.45", + "high": "6775.34", + "low": "6483.83", + "open": "6492.98", + "timestamp": "1537488000", + "volume": "8569.98587321" + }, + { + "close": "6710.01", + "high": "6826.28", + "low": "6624.79", + "open": "6748.85", + "timestamp": "1537574400", + "volume": "5491.80951385" + }, + { + "close": "6702.22", + "high": "6774.91", + "low": "6659.00", + "open": "6710.01", + "timestamp": "1537660800", + "volume": "3248.80491931" + }, + { + "close": "6581.52", + "high": "6721.68", + "low": "6550.96", + "open": "6703.37", + "timestamp": "1537747200", + "volume": "4030.72562001" + }, + { + "close": "6428.99", + "high": "6579.59", + "low": "6324.96", + "open": "6578.70", + "timestamp": "1537833600", + "volume": "8206.61700477" + }, + { + "close": "6461.51", + "high": "6540.00", + "low": "6379.44", + "open": "6428.09", + "timestamp": "1537920000", + "volume": "4295.92674134" + }, + { + "close": "6681.62", + "high": "6736.85", + "low": "6431.95", + "open": "6454.32", + "timestamp": "1538006400", + "volume": "5664.85211251" + }, + { + "close": "6610.76", + "high": "6792.28", + "low": "6525.67", + "open": "6684.50", + "timestamp": "1538092800", + "volume": "7642.04936428" + }, + { + "close": "6579.38", + "high": "6609.02", + "low": "6454.00", + "open": "6609.02", + "timestamp": "1538179200", + "volume": "3382.01592212" + }, + { + "close": "6597.81", + "high": "6628.06", + "low": "6510.00", + "open": "6574.29", + "timestamp": "1538265600", + "volume": "2482.69507513" + }, + { + "close": "6571.20", + "high": "6638.15", + "low": "6477.57", + "open": "6597.79", + "timestamp": "1538352000", + "volume": "4796.04013200" + }, + { + "close": "6500.00", + "high": "6597.00", + "low": "6447.28", + "open": "6569.32", + "timestamp": "1538438400", + "volume": "4116.13342419" + }, + { + "close": "6456.77", + "high": "6510.00", + "low": "6396.34", + "open": "6500.00", + "timestamp": "1538524800", + "volume": "4774.76328174" + }, + { + "close": "6547.56", + "high": "6604.89", + "low": "6450.58", + "open": "6454.81", + "timestamp": "1538611200", + "volume": "3832.70048916" + }, + { + "close": "6582.12", + "high": "6641.35", + "low": "6510.00", + "open": "6548.83", + "timestamp": "1538697600", + "volume": "3807.26928181" + }, + { + "close": "6544.08", + "high": "6595.69", + "low": "6526.28", + "open": "6582.11", + "timestamp": "1538784000", + "volume": "2022.78075908" + }, + { + "close": "6577.63", + "high": "6600.00", + "low": "6493.92", + "open": "6547.93", + "timestamp": "1538870400", + "volume": "2455.65659087" + }, + { + "close": "6604.75", + "high": "6656.63", + "low": "6541.06", + "open": "6574.15", + "timestamp": "1538956800", + "volume": "4079.04424933" + }, + { + "close": "6588.80", + "high": "6623.14", + "low": "6553.13", + "open": "6604.76", + "timestamp": "1539043200", + "volume": "2254.95026959" + }, + { + "close": "6517.55", + "high": "6589.79", + "low": "6387.91", + "open": "6588.72", + "timestamp": "1539129600", + "volume": "5177.06675956" + }, + { + "close": "6152.76", + "high": "6520.43", + "low": "6055.28", + "open": "6517.55", + "timestamp": "1539216000", + "volume": "9616.23958351" + }, + { + "close": "6185.15", + "high": "6243.79", + "low": "6109.79", + "open": "6152.76", + "timestamp": "1539302400", + "volume": "3246.38155720" + }, + { + "close": "6199.69", + "high": "6219.77", + "low": "6168.83", + "open": "6182.03", + "timestamp": "1539388800", + "volume": "1954.04680593" + }, + { + "close": "6183.00", + "high": "6349.47", + "low": "6143.08", + "open": "6201.23", + "timestamp": "1539475200", + "volume": "2525.73820085" + }, + { + "close": "6441.74", + "high": "6756.00", + "low": "6149.28", + "open": "6185.04", + "timestamp": "1539561600", + "volume": "16895.88930388" + }, + { + "close": "6461.20", + "high": "6493.77", + "low": "6386.40", + "open": "6438.20", + "timestamp": "1539648000", + "volume": "4703.09390629" + }, + { + "close": "6437.29", + "high": "6465.39", + "low": "6407.69", + "open": "6457.67", + "timestamp": "1539734400", + "volume": "2961.26337446" + }, + { + "close": "6396.18", + "high": "6490.00", + "low": "6350.00", + "open": "6440.07", + "timestamp": "1539820800", + "volume": "3823.16928503" + }, + { + "close": "6383.46", + "high": "6412.40", + "low": "6355.99", + "open": "6394.23", + "timestamp": "1539907200", + "volume": "2290.05901170" + }, + { + "close": "6412.86", + "high": "6424.16", + "low": "6363.02", + "open": "6380.47", + "timestamp": "1539993600", + "volume": "1261.97849549" + }, + { + "close": "6413.38", + "high": "6470.00", + "low": "6401.01", + "open": "6412.86", + "timestamp": "1540080000", + "volume": "1541.01151749" + }, + { + "close": "6406.06", + "high": "6429.23", + "low": "6372.53", + "open": "6412.62", + "timestamp": "1540166400", + "volume": "2407.53546180" + }, + { + "close": "6393.41", + "high": "6421.58", + "low": "6354.26", + "open": "6409.39", + "timestamp": "1540252800", + "volume": "2851.00556658" + }, + { + "close": "6411.96", + "high": "6473.00", + "low": "6393.00", + "open": "6396.24", + "timestamp": "1540339200", + "volume": "3535.33808825" + }, + { + "close": "6393.53", + "high": "6422.73", + "low": "6361.73", + "open": "6411.96", + "timestamp": "1540425600", + "volume": "3046.60380599" + }, + { + "close": "6406.10", + "high": "6450.30", + "low": "6377.81", + "open": "6393.38", + "timestamp": "1540512000", + "volume": "3323.82631782" + }, + { + "close": "6407.66", + "high": "6420.01", + "low": "6381.25", + "open": "6406.10", + "timestamp": "1540598400", + "volume": "890.12715690" + }, + { + "close": "6405.57", + "high": "6420.00", + "low": "6383.00", + "open": "6407.66", + "timestamp": "1540684800", + "volume": "839.29766473" + }, + { + "close": "6266.52", + "high": "6420.00", + "low": "6208.37", + "open": "6404.27", + "timestamp": "1540771200", + "volume": "5190.82201499" + }, + { + "close": "6269.46", + "high": "6289.00", + "low": "6240.00", + "open": "6266.47", + "timestamp": "1540857600", + "volume": "2523.57742936" + }, + { + "close": "6303.27", + "high": "6350.00", + "low": "6199.25", + "open": "6269.45", + "timestamp": "1540944000", + "volume": "5148.08262352" + }, + { + "close": "6340.99", + "high": "6365.33", + "low": "6288.01", + "open": "6304.50", + "timestamp": "1541030400", + "volume": "2190.97047686" + }, + { + "close": "6350.43", + "high": "6381.25", + "low": "6328.33", + "open": "6343.85", + "timestamp": "1541116800", + "volume": "2678.06948097" + }, + { + "close": "6335.00", + "high": "6351.74", + "low": "6312.48", + "open": "6350.05", + "timestamp": "1541203200", + "volume": "1084.13861953" + }, + { + "close": "6421.76", + "high": "6475.00", + "low": "6310.57", + "open": "6333.59", + "timestamp": "1541289600", + "volume": "2673.81391399" + }, + { + "close": "6403.20", + "high": "6441.43", + "low": "6369.89", + "open": "6428.23", + "timestamp": "1541376000", + "volume": "2335.48865475" + }, + { + "close": "6447.50", + "high": "6460.01", + "low": "6378.24", + "open": "6404.97", + "timestamp": "1541462400", + "volume": "4270.33460011" + }, + { + "close": "6501.00", + "high": "6544.00", + "low": "6442.47", + "open": "6448.17", + "timestamp": "1541548800", + "volume": "4800.82491273" + }, + { + "close": "6405.49", + "high": "6511.27", + "low": "6388.88", + "open": "6501.00", + "timestamp": "1541635200", + "volume": "3966.97303181" + }, + { + "close": "6325.00", + "high": "6418.18", + "low": "6307.00", + "open": "6405.49", + "timestamp": "1541721600", + "volume": "3218.12902607" + }, + { + "close": "6349.32", + "high": "6377.26", + "low": "6323.00", + "open": "6325.00", + "timestamp": "1541808000", + "volume": "1523.39384996" + }, + { + "close": "6357.54", + "high": "6365.00", + "low": "6269.46", + "open": "6349.39", + "timestamp": "1541894400", + "volume": "1718.26855567" + }, + { + "close": "6318.00", + "high": "6388.21", + "low": "6298.50", + "open": "6352.57", + "timestamp": "1541980800", + "volume": "3526.03903239" + }, + { + "close": "6260.91", + "high": "6328.36", + "low": "6244.35", + "open": "6318.01", + "timestamp": "1542067200", + "volume": "3630.56272124" + }, + { + "close": "5595.91", + "high": "6298.47", + "low": "5324.00", + "open": "6255.86", + "timestamp": "1542153600", + "volume": "25121.93301356" + }, + { + "close": "5585.00", + "high": "5641.00", + "low": "5199.80", + "open": "5592.23", + "timestamp": "1542240000", + "volume": "19945.90828161" + }, + { + "close": "5508.71", + "high": "5610.00", + "low": "5411.74", + "open": "5571.12", + "timestamp": "1542326400", + "volume": "8074.60557580" + }, + { + "close": "5503.36", + "high": "5550.66", + "low": "5452.63", + "open": "5514.62", + "timestamp": "1542412800", + "volume": "2732.79162871" + }, + { + "close": "5559.26", + "high": "5658.47", + "low": "5500.00", + "open": "5503.36", + "timestamp": "1542499200", + "volume": "2576.45532010" + }, + { + "close": "4735.44", + "high": "5559.69", + "low": "4694.44", + "open": "5553.01", + "timestamp": "1542585600", + "volume": "28910.66553331" + }, + { + "close": "4352.00", + "high": "4897.36", + "low": "4048.58", + "open": "4732.92", + "timestamp": "1542672000", + "volume": "39775.38943928" + }, + { + "close": "4538.01", + "high": "4635.00", + "low": "4242.33", + "open": "4349.41", + "timestamp": "1542758400", + "volume": "20678.25000596" + }, + { + "close": "4275.23", + "high": "4589.53", + "low": "4194.98", + "open": "4551.47", + "timestamp": "1542844800", + "volume": "10258.46172893" + }, + { + "close": "4288.26", + "high": "4364.46", + "low": "4061.02", + "open": "4268.40", + "timestamp": "1542931200", + "volume": "13322.77736822" + }, + { + "close": "3785.65", + "high": "4376.88", + "low": "3638.48", + "open": "4288.25", + "timestamp": "1543017600", + "volume": "14236.74417437" + }, + { + "close": "3938.89", + "high": "4120.00", + "low": "3474.73", + "open": "3780.67", + "timestamp": "1543104000", + "volume": "26969.94763424" + }, + { + "close": "3727.34", + "high": "4069.59", + "low": "3522.28", + "open": "3934.22", + "timestamp": "1543190400", + "volume": "24357.88293934" + }, + { + "close": "3771.01", + "high": "3834.35", + "low": "3548.76", + "open": "3727.34", + "timestamp": "1543276800", + "volume": "16814.00296565" + }, + { + "close": "4220.16", + "high": "4355.08", + "low": "3771.00", + "open": "3771.01", + "timestamp": "1543363200", + "volume": "22983.71348838" + }, + { + "close": "4249.80", + "high": "4409.77", + "low": "4086.97", + "open": "4219.77", + "timestamp": "1543449600", + "volume": "15944.01262628" + }, + { + "close": "3971.06", + "high": "4300.00", + "low": "3861.00", + "open": "4250.00", + "timestamp": "1543536000", + "volume": "14364.62144791" + }, + { + "close": "4140.39", + "high": "4264.47", + "low": "3904.34", + "open": "3970.56", + "timestamp": "1543622400", + "volume": "6412.23253743" + }, + { + "close": "4102.05", + "high": "4265.00", + "low": "4030.00", + "open": "4140.40", + "timestamp": "1543708800", + "volume": "7019.16205825" + }, + { + "close": "3834.34", + "high": "4115.15", + "low": "3747.00", + "open": "4099.63", + "timestamp": "1543795200", + "volume": "10726.67730460" + }, + { + "close": "3903.52", + "high": "4033.98", + "low": "3730.00", + "open": "3830.81", + "timestamp": "1543881600", + "volume": "12249.93688790" + }, + { + "close": "3696.69", + "high": "3913.62", + "low": "3662.35", + "open": "3903.52", + "timestamp": "1543968000", + "volume": "13443.22072621" + }, + { + "close": "3437.26", + "high": "3844.79", + "low": "3415.22", + "open": "3694.03", + "timestamp": "1544054400", + "volume": "15480.96697218" + }, + { + "close": "3380.68", + "high": "3531.00", + "low": "3210.00", + "open": "3437.22", + "timestamp": "1544140800", + "volume": "26513.23162490" + }, + { + "close": "3398.80", + "high": "3495.99", + "low": "3241.00", + "open": "3376.27", + "timestamp": "1544227200", + "volume": "10176.34927433" + }, + { + "close": "3529.75", + "high": "3633.20", + "low": "3371.09", + "open": "3398.80", + "timestamp": "1544313600", + "volume": "8011.02295177" + }, + { + "close": "3408.00", + "high": "3588.43", + "low": "3355.00", + "open": "3528.68", + "timestamp": "1544400000", + "volume": "10375.26877055" + }, + { + "close": "3353.42", + "high": "3427.27", + "low": "3292.65", + "open": "3406.41", + "timestamp": "1544486400", + "volume": "8951.71070828" + }, + { + "close": "3430.18", + "high": "3490.00", + "low": "3325.70", + "open": "3345.01", + "timestamp": "1544572800", + "volume": "7284.10378196" + }, + { + "close": "3262.73", + "high": "3441.13", + "low": "3221.14", + "open": "3430.20", + "timestamp": "1544659200", + "volume": "11715.01908312" + }, + { + "close": "3195.75", + "high": "3294.81", + "low": "3135.55", + "open": "3263.55", + "timestamp": "1544745600", + "volume": "14437.50526664" + }, + { + "close": "3179.54", + "high": "3230.00", + "low": "3122.28", + "open": "3194.04", + "timestamp": "1544832000", + "volume": "5814.86853241" + }, + { + "close": "3193.78", + "high": "3259.43", + "low": "3178.23", + "open": "3180.84", + "timestamp": "1544918400", + "volume": "6033.50714633" + }, + { + "close": "3496.73", + "high": "3590.00", + "low": "3181.26", + "open": "3191.41", + "timestamp": "1545004800", + "volume": "16389.79444903" + }, + { + "close": "3667.16", + "high": "3684.00", + "low": "3422.77", + "open": "3499.37", + "timestamp": "1545091200", + "volume": "13792.36427592" + }, + { + "close": "3684.50", + "high": "3924.01", + "low": "3642.69", + "open": "3667.16", + "timestamp": "1545177600", + "volume": "21125.61437541" + }, + { + "close": "4073.77", + "high": "4172.07", + "low": "3656.75", + "open": "3684.03", + "timestamp": "1545264000", + "volume": "25986.85291601" + }, + { + "close": "3841.08", + "high": "4162.00", + "low": "3770.00", + "open": "4073.58", + "timestamp": "1545350400", + "volume": "16967.23460506" + }, + { + "close": "3980.90", + "high": "4010.16", + "low": "3780.09", + "open": "3842.59", + "timestamp": "1545436800", + "volume": "7697.59815203" + }, + { + "close": "3943.83", + "high": "4051.00", + "low": "3900.00", + "open": "3977.65", + "timestamp": "1545523200", + "volume": "4609.89261726" + }, + { + "close": "4036.00", + "high": "4236.84", + "low": "3944.84", + "open": "3947.82", + "timestamp": "1545609600", + "volume": "12017.91713092" + }, + { + "close": "3779.99", + "high": "4049.23", + "low": "3674.73", + "open": "4034.54", + "timestamp": "1545696000", + "volume": "11801.43441841" + }, + { + "close": "3810.01", + "high": "3863.34", + "low": "3678.80", + "open": "3780.00", + "timestamp": "1545782400", + "volume": "10064.18282348" + }, + { + "close": "3591.69", + "high": "3841.17", + "low": "3566.00", + "open": "3810.01", + "timestamp": "1545868800", + "volume": "11850.01238190" + }, + { + "close": "3884.97", + "high": "3970.00", + "low": "3575.00", + "open": "3590.26", + "timestamp": "1545955200", + "volume": "13055.71840689" + }, + { + "close": "3725.48", + "high": "3961.85", + "low": "3702.51", + "open": "3884.66", + "timestamp": "1546041600", + "volume": "6901.38233180" + }, + { + "close": "3835.79", + "high": "3870.00", + "low": "3688.76", + "open": "3728.96", + "timestamp": "1546128000", + "volume": "5736.45370818" + }, + { + "close": "3693.30", + "high": "3842.89", + "low": "3630.00", + "open": "3831.03", + "timestamp": "1546214400", + "volume": "6667.16373743" + }, + { + "close": "3823.44", + "high": "3845.46", + "low": "3629.66", + "open": "3693.85", + "timestamp": "1546300800", + "volume": "5149.60627729" + }, + { + "close": "3885.87", + "high": "3918.67", + "low": "3770.00", + "open": "3825.41", + "timestamp": "1546387200", + "volume": "5534.46951453" + }, + { + "close": "3787.81", + "high": "3893.40", + "low": "3760.00", + "open": "3890.27", + "timestamp": "1546473600", + "volume": "4803.24610920" + }, + { + "close": "3817.71", + "high": "3850.33", + "low": "3732.38", + "open": "3785.64", + "timestamp": "1546560000", + "volume": "7452.05894356" + }, + { + "close": "3791.84", + "high": "3887.09", + "low": "3780.00", + "open": "3822.00", + "timestamp": "1546646400", + "volume": "3656.37531439" + }, + { + "close": "4040.71", + "high": "4090.00", + "low": "3753.00", + "open": "3795.38", + "timestamp": "1546732800", + "volume": "5400.71486407" + }, + { + "close": "4005.45", + "high": "4070.00", + "low": "3964.01", + "open": "4040.71", + "timestamp": "1546819200", + "volume": "7445.09600426" + }, + { + "close": "3994.90", + "high": "4112.00", + "low": "3934.73", + "open": "4005.00", + "timestamp": "1546905600", + "volume": "11819.98676966" + }, + { + "close": "4000.18", + "high": "4060.00", + "low": "3948.44", + "open": "3994.75", + "timestamp": "1546992000", + "volume": "7389.66772280" + }, + { + "close": "3627.51", + "high": "4036.22", + "low": "3503.44", + "open": "4003.09", + "timestamp": "1547078400", + "volume": "16118.42088248" + }, + { + "close": "3632.02", + "high": "3704.60", + "low": "3569.85", + "open": "3627.65", + "timestamp": "1547164800", + "volume": "10571.08164263" + }, + { + "close": "3617.13", + "high": "3650.35", + "low": "3557.09", + "open": "3631.00", + "timestamp": "1547251200", + "volume": "3184.35219414" + }, + { + "close": "3515.95", + "high": "3654.02", + "low": "3476.00", + "open": "3617.75", + "timestamp": "1547337600", + "volume": "5908.52280454" + }, + { + "close": "3664.28", + "high": "3714.00", + "low": "3506.00", + "open": "3517.03", + "timestamp": "1547424000", + "volume": "9925.99072165" + }, + { + "close": "3576.93", + "high": "3687.02", + "low": "3534.68", + "open": "3664.28", + "timestamp": "1547510400", + "volume": "8059.81737770" + }, + { + "close": "3605.91", + "high": "3669.00", + "low": "3570.48", + "open": "3576.92", + "timestamp": "1547596800", + "volume": "7675.06606371" + }, + { + "close": "3638.01", + "high": "3660.00", + "low": "3534.25", + "open": "3609.50", + "timestamp": "1547683200", + "volume": "7499.52552971" + }, + { + "close": "3609.21", + "high": "3641.90", + "low": "3577.00", + "open": "3638.01", + "timestamp": "1547769600", + "volume": "5023.51029080" + }, + { + "close": "3681.00", + "high": "3774.00", + "low": "3602.60", + "open": "3609.29", + "timestamp": "1547856000", + "volume": "4080.88346413" + }, + { + "close": "3536.72", + "high": "3703.27", + "low": "3470.00", + "open": "3680.00", + "timestamp": "1547942400", + "volume": "5591.01583422" + }, + { + "close": "3531.51", + "high": "3573.29", + "low": "3485.58", + "open": "3537.42", + "timestamp": "1548028800", + "volume": "5821.89983137" + }, + { + "close": "3576.81", + "high": "3615.80", + "low": "3401.36", + "open": "3531.51", + "timestamp": "1548115200", + "volume": "6877.06367550" + }, + { + "close": "3552.32", + "high": "3620.23", + "low": "3518.00", + "open": "3574.44", + "timestamp": "1548201600", + "volume": "6170.84267224" + }, + { + "close": "3570.73", + "high": "3598.00", + "low": "3524.00", + "open": "3553.20", + "timestamp": "1548288000", + "volume": "4488.01463801" + }, + { + "close": "3560.00", + "high": "3578.79", + "low": "3511.00", + "open": "3570.67", + "timestamp": "1548374400", + "volume": "4961.79512299" + }, + { + "close": "3555.56", + "high": "3657.89", + "low": "3536.51", + "open": "3560.94", + "timestamp": "1548460800", + "volume": "2697.88387935" + }, + { + "close": "3533.23", + "high": "3564.12", + "low": "3456.00", + "open": "3555.31", + "timestamp": "1548547200", + "volume": "3852.65964090" + }, + { + "close": "3429.50", + "high": "3536.77", + "low": "3357.30", + "open": "3532.23", + "timestamp": "1548633600", + "volume": "10345.10091040" + }, + { + "close": "3390.50", + "high": "3438.76", + "low": "3322.19", + "open": "3431.43", + "timestamp": "1548720000", + "volume": "7284.38686266" + }, + { + "close": "3437.35", + "high": "3465.05", + "low": "3372.34", + "open": "3391.25", + "timestamp": "1548806400", + "volume": "5704.02340186" + }, + { + "close": "3413.11", + "high": "3474.20", + "low": "3392.60", + "open": "3438.00", + "timestamp": "1548892800", + "volume": "5951.81816980" + }, + { + "close": "3434.83", + "high": "3460.00", + "low": "3364.53", + "open": "3413.69", + "timestamp": "1548979200", + "volume": "6659.84752495" + }, + { + "close": "3462.82", + "high": "3485.00", + "low": "3406.38", + "open": "3434.83", + "timestamp": "1549065600", + "volume": "3051.95860768" + }, + { + "close": "3414.82", + "high": "3476.33", + "low": "3384.67", + "open": "3470.50", + "timestamp": "1549152000", + "volume": "2813.89222442" + }, + { + "close": "3410.87", + "high": "3439.46", + "low": "3394.85", + "open": "3413.75", + "timestamp": "1549238400", + "volume": "3244.08497898" + }, + { + "close": "3431.39", + "high": "3435.00", + "low": "3396.00", + "open": "3409.81", + "timestamp": "1549324800", + "volume": "4045.62530164" + }, + { + "close": "3364.62", + "high": "3445.60", + "low": "3328.70", + "open": "3431.81", + "timestamp": "1549411200", + "volume": "6137.40639817" + }, + { + "close": "3359.33", + "high": "3383.29", + "low": "3350.00", + "open": "3364.00", + "timestamp": "1549497600", + "volume": "4293.55581410" + }, + { + "close": "3622.94", + "high": "3711.04", + "low": "3337.91", + "open": "3358.39", + "timestamp": "1549584000", + "volume": "14388.64754224" + }, + { + "close": "3622.62", + "high": "3639.74", + "low": "3589.52", + "open": "3626.12", + "timestamp": "1549670400", + "volume": "4054.50461695" + }, + { + "close": "3650.37", + "high": "3662.43", + "low": "3576.16", + "open": "3622.74", + "timestamp": "1549756800", + "volume": "4155.50568273" + }, + { + "close": "3588.70", + "high": "3652.56", + "low": "3578.70", + "open": "3651.32", + "timestamp": "1549843200", + "volume": "7931.40887407" + }, + { + "close": "3585.94", + "high": "3619.93", + "low": "3548.28", + "open": "3588.99", + "timestamp": "1549929600", + "volume": "10074.81670532" + }, + { + "close": "3574.93", + "high": "3629.81", + "low": "3541.00", + "open": "3585.70", + "timestamp": "1550016000", + "volume": "7992.74321134" + }, + { + "close": "3560.46", + "high": "3590.74", + "low": "3531.01", + "open": "3575.01", + "timestamp": "1550102400", + "volume": "5910.24312876" + }, + { + "close": "3566.29", + "high": "3620.53", + "low": "3544.88", + "open": "3560.45", + "timestamp": "1550188800", + "volume": "6234.76805726" + }, + { + "close": "3579.92", + "high": "3609.00", + "low": "3561.96", + "open": "3566.29", + "timestamp": "1550275200", + "volume": "3442.47630393" + }, + { + "close": "3625.60", + "high": "3663.34", + "low": "3553.98", + "open": "3580.43", + "timestamp": "1550361600", + "volume": "5012.46127538" + }, + { + "close": "3869.80", + "high": "3916.47", + "low": "3614.82", + "open": "3625.60", + "timestamp": "1550448000", + "volume": "15567.08485429" + }, + { + "close": "3888.46", + "high": "4000.00", + "low": "3840.08", + "open": "3870.97", + "timestamp": "1550534400", + "volume": "12525.13651013" + }, + { + "close": "3936.53", + "high": "3967.52", + "low": "3861.49", + "open": "3889.92", + "timestamp": "1550620800", + "volume": "9854.35493853" + }, + { + "close": "3900.40", + "high": "3989.99", + "low": "3866.25", + "open": "3936.80", + "timestamp": "1550707200", + "volume": "8055.79892817" + }, + { + "close": "3939.82", + "high": "3957.00", + "low": "3882.59", + "open": "3900.64", + "timestamp": "1550793600", + "volume": "6593.85993401" + }, + { + "close": "4113.53", + "high": "4157.87", + "low": "3905.63", + "open": "3939.83", + "timestamp": "1550880000", + "volume": "7966.31721086" + }, + { + "close": "3730.68", + "high": "4190.00", + "low": "3714.42", + "open": "4113.56", + "timestamp": "1550966400", + "volume": "13737.01398845" + }, + { + "close": "3820.71", + "high": "3861.81", + "low": "3732.60", + "open": "3733.78", + "timestamp": "1551052800", + "volume": "8835.36224921" + }, + { + "close": "3795.06", + "high": "3830.00", + "low": "3760.09", + "open": "3817.93", + "timestamp": "1551139200", + "volume": "6543.16453722" + }, + { + "close": "3798.47", + "high": "3822.85", + "low": "3658.19", + "open": "3794.42", + "timestamp": "1551225600", + "volume": "7602.29984472" + }, + { + "close": "3791.36", + "high": "3897.62", + "low": "3755.00", + "open": "3796.49", + "timestamp": "1551312000", + "volume": "6747.88027166" + }, + { + "close": "3807.05", + "high": "3845.30", + "low": "3789.50", + "open": "3791.02", + "timestamp": "1551398400", + "volume": "4761.41015902" + }, + { + "close": "3810.46", + "high": "3818.75", + "low": "3760.00", + "open": "3805.00", + "timestamp": "1551484800", + "volume": "3259.74312485" + }, + { + "close": "3789.52", + "high": "3822.39", + "low": "3756.00", + "open": "3810.47", + "timestamp": "1551571200", + "volume": "2508.08649072" + }, + { + "close": "3698.66", + "high": "3806.90", + "low": "3670.00", + "open": "3789.70", + "timestamp": "1551657600", + "volume": "7293.71962839" + }, + { + "close": "3844.07", + "high": "3877.10", + "low": "3690.00", + "open": "3698.65", + "timestamp": "1551744000", + "volume": "7280.82397551" + }, + { + "close": "3851.55", + "high": "3895.12", + "low": "3808.80", + "open": "3844.07", + "timestamp": "1551830400", + "volume": "6402.67507493" + }, + { + "close": "3856.64", + "high": "3891.04", + "low": "3826.13", + "open": "3851.26", + "timestamp": "1551916800", + "volume": "7964.50825371" + }, + { + "close": "3844.64", + "high": "3924.37", + "low": "3760.10", + "open": "3856.78", + "timestamp": "1552003200", + "volume": "7707.39667049" + }, + { + "close": "3916.43", + "high": "3950.25", + "low": "3835.66", + "open": "3841.27", + "timestamp": "1552089600", + "volume": "5125.89830383" + }, + { + "close": "3897.92", + "high": "3916.43", + "low": "3862.00", + "open": "3916.42", + "timestamp": "1552176000", + "volume": "3000.60671855" + }, + { + "close": "3849.25", + "high": "3912.89", + "low": "3812.64", + "open": "3898.14", + "timestamp": "1552262400", + "volume": "6612.11516125" + }, + { + "close": "3859.74", + "high": "3877.69", + "low": "3791.07", + "open": "3848.86", + "timestamp": "1552348800", + "volume": "5794.61473428" + }, + { + "close": "3848.48", + "high": "3874.68", + "low": "3820.00", + "open": "3861.37", + "timestamp": "1552435200", + "volume": "4275.54000025" + }, + { + "close": "3854.77", + "high": "3903.98", + "low": "3775.01", + "open": "3848.10", + "timestamp": "1552521600", + "volume": "5167.56617609" + }, + { + "close": "3901.21", + "high": "3912.06", + "low": "3843.09", + "open": "3857.33", + "timestamp": "1552608000", + "volume": "6411.98332751" + }, + { + "close": "3990.00", + "high": "4040.00", + "low": "3899.12", + "open": "3899.19", + "timestamp": "1552694400", + "volume": "6959.47788339" + }, + { + "close": "3965.50", + "high": "3992.42", + "low": "3927.28", + "open": "3990.00", + "timestamp": "1552780800", + "volume": "2711.95016796" + }, + { + "close": "3969.59", + "high": "4016.63", + "low": "3929.83", + "open": "3965.63", + "timestamp": "1552867200", + "volume": "5420.23037801" + }, + { + "close": "3998.13", + "high": "4012.63", + "low": "3947.15", + "open": "3969.94", + "timestamp": "1552953600", + "volume": "5317.45055524" + }, + { + "close": "4031.59", + "high": "4050.00", + "low": "3962.60", + "open": "3999.50", + "timestamp": "1553040000", + "volume": "6244.95370182" + }, + { + "close": "3974.21", + "high": "4055.35", + "low": "3919.63", + "open": "4033.70", + "timestamp": "1553126400", + "volume": "7561.75989694" + }, + { + "close": "3982.07", + "high": "4000.81", + "low": "3958.94", + "open": "3974.50", + "timestamp": "1553212800", + "volume": "3453.36892821" + }, + { + "close": "3982.52", + "high": "4001.17", + "low": "3957.11", + "open": "3980.40", + "timestamp": "1553299200", + "volume": "2259.56452610" + }, + { + "close": "3969.99", + "high": "3980.97", + "low": "3942.04", + "open": "3979.19", + "timestamp": "1553385600", + "volume": "2204.06560941" + }, + { + "close": "3910.51", + "high": "3980.22", + "low": "3850.45", + "open": "3970.23", + "timestamp": "1553472000", + "volume": "6913.36709721" + }, + { + "close": "3922.58", + "high": "3936.36", + "low": "3879.50", + "open": "3910.00", + "timestamp": "1553558400", + "volume": "4315.60487708" + }, + { + "close": "4025.50", + "high": "4037.11", + "low": "3912.19", + "open": "3922.58", + "timestamp": "1553644800", + "volume": "8151.67504888" + }, + { + "close": "4012.23", + "high": "4025.56", + "low": "3992.60", + "open": "4025.50", + "timestamp": "1553731200", + "volume": "3927.54682157" + }, + { + "close": "4090.00", + "high": "4102.57", + "low": "4005.00", + "open": "4011.00", + "timestamp": "1553817600", + "volume": "8391.03462414" + }, + { + "close": "4094.92", + "high": "4130.36", + "low": "4040.00", + "open": "4090.00", + "timestamp": "1553904000", + "volume": "3923.13646640" + }, + { + "close": "4096.08", + "high": "4101.70", + "low": "4074.29", + "open": "4094.92", + "timestamp": "1553990400", + "volume": "2402.58820541" + }, + { + "close": "4136.32", + "high": "4150.00", + "low": "4052.56", + "open": "4092.02", + "timestamp": "1554076800", + "volume": "7232.98731201" + }, + { + "close": "4899.63", + "high": "5080.00", + "low": "4130.64", + "open": "4133.93", + "timestamp": "1554163200", + "volume": "30686.17351442" + }, + { + "close": "4978.23", + "high": "5345.00", + "low": "4800.50", + "open": "4899.01", + "timestamp": "1554249600", + "volume": "29321.27268405" + }, + { + "close": "4907.94", + "high": "5077.35", + "low": "4778.59", + "open": "4972.83", + "timestamp": "1554336000", + "volume": "15898.11514808" + }, + { + "close": "5039.73", + "high": "5067.62", + "low": "4883.83", + "open": "4911.14", + "timestamp": "1554422400", + "volume": "13023.74651610" + }, + { + "close": "5041.39", + "high": "5240.00", + "low": "4900.00", + "open": "5041.00", + "timestamp": "1554508800", + "volume": "10049.84478829" + }, + { + "close": "5190.85", + "high": "5253.49", + "low": "5028.30", + "open": "5041.92", + "timestamp": "1554595200", + "volume": "10872.51935616" + }, + { + "close": "5287.88", + "high": "5347.37", + "low": "5127.68", + "open": "5192.92", + "timestamp": "1554681600", + "volume": "13344.98151487" + }, + { + "close": "5192.60", + "high": "5288.95", + "low": "5136.01", + "open": "5287.97", + "timestamp": "1554768000", + "volume": "9410.35350033" + }, + { + "close": "5323.47", + "high": "5466.06", + "low": "5161.00", + "open": "5184.03", + "timestamp": "1554854400", + "volume": "10723.93474696" + }, + { + "close": "5040.20", + "high": "5344.31", + "low": "4966.87", + "open": "5323.47", + "timestamp": "1554940800", + "volume": "15052.95606333" + }, + { + "close": "5076.35", + "high": "5122.48", + "low": "4912.00", + "open": "5037.82", + "timestamp": "1555027200", + "volume": "8057.03847684" + }, + { + "close": "5063.63", + "high": "5122.01", + "low": "5033.73", + "open": "5075.74", + "timestamp": "1555113600", + "volume": "4520.43702971" + }, + { + "close": "5162.72", + "high": "5185.26", + "low": "5012.73", + "open": "5064.00", + "timestamp": "1555200000", + "volume": "3443.44728316" + }, + { + "close": "5027.31", + "high": "5192.01", + "low": "4948.57", + "open": "5160.54", + "timestamp": "1555286400", + "volume": "7423.01375858" + }, + { + "close": "5202.43", + "high": "5231.96", + "low": "5014.77", + "open": "5027.33", + "timestamp": "1555372800", + "volume": "7675.40412015" + }, + { + "close": "5233.72", + "high": "5275.07", + "low": "5170.01", + "open": "5201.47", + "timestamp": "1555459200", + "volume": "6741.07720986" + }, + { + "close": "5281.58", + "high": "5325.00", + "low": "5218.23", + "open": "5227.60", + "timestamp": "1555545600", + "volume": "6375.89568714" + }, + { + "close": "5289.91", + "high": "5357.96", + "low": "5180.37", + "open": "5283.00", + "timestamp": "1555632000", + "volume": "5285.60637017" + }, + { + "close": "5318.89", + "high": "5362.97", + "low": "5253.82", + "open": "5289.91", + "timestamp": "1555718400", + "volume": "3665.56962108" + }, + { + "close": "5295.65", + "high": "5346.91", + "low": "5212.80", + "open": "5318.94", + "timestamp": "1555804800", + "volume": "4631.03916752" + }, + { + "close": "5386.80", + "high": "5439.12", + "low": "5249.00", + "open": "5295.96", + "timestamp": "1555891200", + "volume": "7127.11186779" + }, + { + "close": "5531.32", + "high": "5627.00", + "low": "5363.24", + "open": "5388.22", + "timestamp": "1555977600", + "volume": "10132.40317154" + }, + { + "close": "5440.95", + "high": "5623.30", + "low": "5372.00", + "open": "5531.29", + "timestamp": "1556064000", + "volume": "10521.03763127" + }, + { + "close": "5132.55", + "high": "5510.00", + "low": "4991.42", + "open": "5440.95", + "timestamp": "1556150400", + "volume": "9893.93590864" + }, + { + "close": "5155.19", + "high": "5291.48", + "low": "5046.31", + "open": "5132.50", + "timestamp": "1556236800", + "volume": "15033.10177930" + }, + { + "close": "5168.91", + "high": "5218.31", + "low": "5113.00", + "open": "5154.11", + "timestamp": "1556323200", + "volume": "4041.33355341" + }, + { + "close": "5160.98", + "high": "5213.23", + "low": "5099.00", + "open": "5171.51", + "timestamp": "1556409600", + "volume": "3957.25435637" + }, + { + "close": "5149.11", + "high": "5191.96", + "low": "5071.58", + "open": "5152.98", + "timestamp": "1556496000", + "volume": "5753.61513714" + }, + { + "close": "5269.00", + "high": "5287.40", + "low": "5127.05", + "open": "5150.21", + "timestamp": "1556582400", + "volume": "5055.27283570" + }, + { + "close": "5318.42", + "high": "5357.96", + "low": "5263.03", + "open": "5267.86", + "timestamp": "1556668800", + "volume": "4209.28441353" + }, + { + "close": "5385.00", + "high": "5422.94", + "low": "5304.99", + "open": "5322.28", + "timestamp": "1556755200", + "volume": "5908.52172325" + }, + { + "close": "5658.22", + "high": "5796.56", + "low": "5363.10", + "open": "5385.00", + "timestamp": "1556841600", + "volume": "12700.58899257" + }, + { + "close": "5764.65", + "high": "5846.13", + "low": "5510.00", + "open": "5659.82", + "timestamp": "1556928000", + "volume": "8525.45570755" + }, + { + "close": "5709.32", + "high": "5782.55", + "low": "5624.25", + "open": "5766.46", + "timestamp": "1557014400", + "volume": "5162.56182988" + }, + { + "close": "5685.46", + "high": "5755.79", + "low": "5562.44", + "open": "5714.40", + "timestamp": "1557100800", + "volume": "6826.98087533" + }, + { + "close": "5751.54", + "high": "5970.00", + "low": "5686.88", + "open": "5686.88", + "timestamp": "1557187200", + "volume": "10741.56186069" + }, + { + "close": "5940.89", + "high": "5986.00", + "low": "5658.66", + "open": "5751.54", + "timestamp": "1557273600", + "volume": "6320.41354540" + }, + { + "close": "6156.70", + "high": "6172.00", + "low": "5932.83", + "open": "5945.32", + "timestamp": "1557360000", + "volume": "9081.24077807" + }, + { + "close": "6342.84", + "high": "6426.80", + "low": "6105.00", + "open": "6151.66", + "timestamp": "1557446400", + "volume": "13821.71360689" + }, + { + "close": "7217.47", + "high": "7445.00", + "low": "6338.93", + "open": "6338.93", + "timestamp": "1557532800", + "volume": "22331.43531269" + }, + { + "close": "6974.35", + "high": "7585.00", + "low": "6762.57", + "open": "7214.40", + "timestamp": "1557619200", + "volume": "27398.21436403" + }, + { + "close": "7810.05", + "high": "8167.50", + "low": "6863.75", + "open": "6968.84", + "timestamp": "1557705600", + "volume": "27299.34473923" + }, + { + "close": "7986.00", + "high": "8335.56", + "low": "7618.99", + "open": "7810.72", + "timestamp": "1557792000", + "volume": "18881.44115957" + }, + { + "close": "8208.69", + "high": "8300.00", + "low": "7838.00", + "open": "7991.72", + "timestamp": "1557878400", + "volume": "16613.07123458" + }, + { + "close": "7880.00", + "high": "8390.95", + "low": "7654.93", + "open": "8203.97", + "timestamp": "1557964800", + "volume": "17078.70375960" + }, + { + "close": "7351.71", + "high": "7942.09", + "low": "6178.00", + "open": "7879.28", + "timestamp": "1558051200", + "volume": "27307.57969969" + }, + { + "close": "7260.12", + "high": "7493.85", + "low": "7205.57", + "open": "7352.39", + "timestamp": "1558137600", + "volume": "7564.89968988" + }, + { + "close": "8200.00", + "high": "8299.99", + "low": "7247.86", + "open": "7257.82", + "timestamp": "1558224000", + "volume": "15595.26745165" + }, + { + "close": "8005.64", + "high": "8199.97", + "low": "7581.03", + "open": "8193.45", + "timestamp": "1558310400", + "volume": "13426.78750889" + }, + { + "close": "7955.16", + "high": "8117.48", + "low": "7676.27", + "open": "8007.67", + "timestamp": "1558396800", + "volume": "7518.55567690" + }, + { + "close": "7624.95", + "high": "8049.22", + "low": "7505.69", + "open": "7949.18", + "timestamp": "1558483200", + "volume": "8396.82203697" + }, + { + "close": "7880.22", + "high": "7980.00", + "low": "7468.31", + "open": "7622.90", + "timestamp": "1558569600", + "volume": "8370.35625318" + }, + { + "close": "7999.02", + "high": "8188.87", + "low": "7795.95", + "open": "7880.40", + "timestamp": "1558656000", + "volume": "9358.97181211" + }, + { + "close": "8064.64", + "high": "8158.45", + "low": "7939.76", + "open": "7999.02", + "timestamp": "1558742400", + "volume": "3361.65325124" + }, + { + "close": "8733.26", + "high": "8802.29", + "low": "7888.91", + "open": "8066.15", + "timestamp": "1558828800", + "volume": "8526.81164447" + }, + { + "close": "8770.73", + "high": "8939.18", + "low": "8653.68", + "open": "8733.27", + "timestamp": "1558915200", + "volume": "8948.02467376" + }, + { + "close": "8717.96", + "high": "8817.41", + "low": "8540.94", + "open": "8774.45", + "timestamp": "1559001600", + "volume": "6144.01124571" + }, + { + "close": "8663.41", + "high": "8762.39", + "low": "8421.12", + "open": "8715.35", + "timestamp": "1559088000", + "volume": "7584.25785894" + }, + { + "close": "8277.76", + "high": "9096.79", + "low": "8000.00", + "open": "8663.07", + "timestamp": "1559174400", + "volume": "15259.58792555" + }, + { + "close": "8547.20", + "high": "8589.99", + "low": "8109.74", + "open": "8277.76", + "timestamp": "1559260800", + "volume": "9957.91006545" + }, + { + "close": "8556.27", + "high": "8624.72", + "low": "8457.33", + "open": "8545.80", + "timestamp": "1559347200", + "volume": "5167.05130706" + }, + { + "close": "8734.49", + "high": "8833.97", + "low": "8546.01", + "open": "8560.10", + "timestamp": "1559433600", + "volume": "4263.03616530" + }, + { + "close": "8103.64", + "high": "8745.96", + "low": "8049.22", + "open": "8735.84", + "timestamp": "1559520000", + "volume": "9955.03261894" + }, + { + "close": "7665.53", + "high": "8103.63", + "low": "7432.84", + "open": "8103.63", + "timestamp": "1559606400", + "volume": "15485.70215021" + }, + { + "close": "7785.94", + "high": "7924.48", + "low": "7570.90", + "open": "7673.41", + "timestamp": "1559692800", + "volume": "9193.71188764" + }, + { + "close": "7806.07", + "high": "7878.62", + "low": "7449.68", + "open": "7784.62", + "timestamp": "1559779200", + "volume": "8738.66635896" + }, + { + "close": "8001.25", + "high": "8134.99", + "low": "7758.93", + "open": "7801.97", + "timestamp": "1559865600", + "volume": "9012.09615945" + }, + { + "close": "7932.27", + "high": "8061.12", + "low": "7777.67", + "open": "8002.68", + "timestamp": "1559952000", + "volume": "4870.11556741" + }, + { + "close": "7632.99", + "high": "7966.58", + "low": "7511.41", + "open": "7933.17", + "timestamp": "1560038400", + "volume": "3895.84810538" + }, + { + "close": "8021.10", + "high": "8090.00", + "low": "7523.16", + "open": "7629.98", + "timestamp": "1560124800", + "volume": "7150.59429755" + }, + { + "close": "7919.10", + "high": "8057.32", + "low": "7713.34", + "open": "8017.99", + "timestamp": "1560211200", + "volume": "5552.68803771" + }, + { + "close": "8176.27", + "high": "8266.00", + "low": "7821.73", + "open": "7915.70", + "timestamp": "1560297600", + "volume": "8577.16249687" + }, + { + "close": "8238.00", + "high": "8335.56", + "low": "8049.22", + "open": "8171.12", + "timestamp": "1560384000", + "volume": "7237.80039095" + }, + { + "close": "8697.54", + "high": "8737.37", + "low": "8174.92", + "open": "8235.44", + "timestamp": "1560470400", + "volume": "8678.25030630" + }, + { + "close": "8857.19", + "high": "8911.98", + "low": "8623.52", + "open": "8694.74", + "timestamp": "1560556800", + "volume": "5275.75306910" + }, + { + "close": "8974.19", + "high": "9391.85", + "low": "8805.00", + "open": "8857.19", + "timestamp": "1560643200", + "volume": "15018.85335613" + }, + { + "close": "9333.48", + "high": "9477.70", + "low": "8973.02", + "open": "8973.02", + "timestamp": "1560729600", + "volume": "12760.96069746" + }, + { + "close": "9078.84", + "high": "9361.87", + "low": "8918.00", + "open": "9333.48", + "timestamp": "1560816000", + "volume": "11327.45394298" + }, + { + "close": "9278.27", + "high": "9325.85", + "low": "9036.19", + "open": "9076.51", + "timestamp": "1560902400", + "volume": "4687.25984305" + }, + { + "close": "9534.99", + "high": "9600.00", + "low": "9211.08", + "open": "9280.17", + "timestamp": "1560988800", + "volume": "7870.31583938" + }, + { + "close": "10222.12", + "high": "10229.49", + "low": "9534.97", + "open": "9534.99", + "timestamp": "1561075200", + "volume": "12553.09963424" + }, + { + "close": "10661.30", + "high": "11200.00", + "low": "10085.50", + "open": "10222.13", + "timestamp": "1561161600", + "volume": "13709.30032222" + }, + { + "close": "10831.95", + "high": "11247.62", + "low": "10483.33", + "open": "10665.66", + "timestamp": "1561248000", + "volume": "7270.64581160" + }, + { + "close": "11029.63", + "high": "11099.00", + "low": "10551.51", + "open": "10827.23", + "timestamp": "1561334400", + "volume": "8247.39381098" + }, + { + "close": "11751.01", + "high": "11796.37", + "low": "11000.02", + "open": "11030.00", + "timestamp": "1561420800", + "volume": "12133.57175867" + }, + { + "close": "12920.54", + "high": "13880.00", + "low": "11647.07", + "open": "11760.00", + "timestamp": "1561507200", + "volume": "37487.80242579" + }, + { + "close": "11153.74", + "high": "13355.61", + "low": "10300.00", + "open": "12927.44", + "timestamp": "1561593600", + "volume": "36106.96055323" + }, + { + "close": "12354.43", + "high": "12447.46", + "low": "10739.10", + "open": "11153.73", + "timestamp": "1561680000", + "volume": "18718.10158772" + }, + { + "close": "11858.62", + "high": "12386.76", + "low": "11317.03", + "open": "12354.45", + "timestamp": "1561766400", + "volume": "12265.99736052" + }, + { + "close": "10760.10", + "high": "12200.06", + "low": "10651.30", + "open": "11867.35", + "timestamp": "1561852800", + "volume": "12642.61772277" + }, + { + "close": "10577.43", + "high": "11200.41", + "low": "9950.00", + "open": "10759.24", + "timestamp": "1561939200", + "volume": "22917.43710404" + }, + { + "close": "10828.90", + "high": "10942.63", + "low": "9614.08", + "open": "10581.78", + "timestamp": "1562025600", + "volume": "20285.24655295" + }, + { + "close": "11967.43", + "high": "12009.00", + "low": "10830.10", + "open": "10830.10", + "timestamp": "1562112000", + "volume": "19389.85475767" + }, + { + "close": "11146.34", + "high": "12061.04", + "low": "11052.74", + "open": "11970.00", + "timestamp": "1562198400", + "volume": "11185.29420376" + }, + { + "close": "10997.84", + "high": "11440.00", + "low": "10769.15", + "open": "11144.82", + "timestamp": "1562284800", + "volume": "11893.43794970" + }, + { + "close": "11240.00", + "high": "11735.00", + "low": "10982.89", + "open": "10996.82", + "timestamp": "1562371200", + "volume": "7892.17866812" + }, + { + "close": "11469.96", + "high": "11627.00", + "low": "11083.76", + "open": "11233.21", + "timestamp": "1562457600", + "volume": "6683.05546715" + }, + { + "close": "12286.14", + "high": "12398.00", + "low": "11332.19", + "open": "11478.43", + "timestamp": "1562544000", + "volume": "11901.90089462" + }, + { + "close": "12567.23", + "high": "12883.48", + "low": "12030.43", + "open": "12299.94", + "timestamp": "1562630400", + "volume": "15115.55238390" + }, + { + "close": "12098.95", + "high": "13200.00", + "low": "11550.00", + "open": "12574.88", + "timestamp": "1562716800", + "volume": "19838.38994897" + }, + { + "close": "11349.24", + "high": "12104.97", + "low": "10966.81", + "open": "12101.44", + "timestamp": "1562803200", + "volume": "18468.68600043" + }, + { + "close": "11808.91", + "high": "11942.39", + "low": "11083.52", + "open": "11352.74", + "timestamp": "1562889600", + "volume": "9176.67942993" + }, + { + "close": "11378.79", + "high": "11846.61", + "low": "10810.00", + "open": "11811.08", + "timestamp": "1562976000", + "volume": "9391.35341435" + }, + { + "close": "10191.87", + "high": "11467.30", + "low": "10090.00", + "open": "11382.03", + "timestamp": "1563062400", + "volume": "12170.40823763" + }, + { + "close": "10850.00", + "high": "11080.37", + "low": "9855.00", + "open": "10191.87", + "timestamp": "1563148800", + "volume": "16048.02718406" + }, + { + "close": "9412.81", + "high": "11042.11", + "low": "9366.00", + "open": "10848.27", + "timestamp": "1563235200", + "volume": "20761.02748001" + }, + { + "close": "9699.35", + "high": "9993.00", + "low": "9049.54", + "open": "9427.45", + "timestamp": "1563321600", + "volume": "16992.78525932" + }, + { + "close": "10648.60", + "high": "10797.00", + "low": "9280.33", + "open": "9712.15", + "timestamp": "1563408000", + "volume": "18289.54217585" + }, + { + "close": "10535.43", + "high": "10776.99", + "low": "10102.58", + "open": "10638.44", + "timestamp": "1563494400", + "volume": "13787.45646718" + }, + { + "close": "10750.11", + "high": "11120.00", + "low": "10359.17", + "open": "10533.71", + "timestamp": "1563580800", + "volume": "9964.67388282" + }, + { + "close": "10600.24", + "high": "10839.09", + "low": "10325.00", + "open": "10757.15", + "timestamp": "1563667200", + "volume": "5628.16176664" + }, + { + "close": "10328.83", + "high": "10686.89", + "low": "10052.25", + "open": "10605.03", + "timestamp": "1563753600", + "volume": "9371.30644231" + }, + { + "close": "9847.02", + "high": "10327.33", + "low": "9801.88", + "open": "10315.87", + "timestamp": "1563840000", + "volume": "9040.84882621" + }, + { + "close": "9763.67", + "high": "9911.50", + "low": "9514.96", + "open": "9841.42", + "timestamp": "1563926400", + "volume": "9433.34520017" + }, + { + "close": "9883.96", + "high": "10187.00", + "low": "9734.19", + "open": "9781.52", + "timestamp": "1564012800", + "volume": "6377.95751785" + }, + { + "close": "9846.94", + "high": "9897.46", + "low": "9650.00", + "open": "9886.08", + "timestamp": "1564099200", + "volume": "5570.10914746" + }, + { + "close": "9481.37", + "high": "10235.00", + "low": "9299.00", + "open": "9846.94", + "timestamp": "1564185600", + "volume": "9614.10207519" + }, + { + "close": "9533.19", + "high": "9634.50", + "low": "9111.00", + "open": "9467.84", + "timestamp": "1564272000", + "volume": "3860.83481690" + }, + { + "close": "9495.39", + "high": "9725.17", + "low": "9360.00", + "open": "9538.73", + "timestamp": "1564358400", + "volume": "5068.65430930" + }, + { + "close": "9593.62", + "high": "9775.00", + "low": "9373.48", + "open": "9508.21", + "timestamp": "1564444800", + "volume": "5533.97118529" + }, + { + "close": "10085.34", + "high": "10143.20", + "low": "9574.09", + "open": "9592.26", + "timestamp": "1564531200", + "volume": "7917.50847720" + }, + { + "close": "10407.71", + "high": "10499.00", + "low": "9878.09", + "open": "10096.01", + "timestamp": "1564617600", + "volume": "7681.73235986" + }, + { + "close": "10529.51", + "high": "10670.00", + "low": "10318.47", + "open": "10416.79", + "timestamp": "1564704000", + "volume": "9286.86172741" + }, + { + "close": "10821.52", + "high": "10919.00", + "low": "10502.80", + "open": "10529.51", + "timestamp": "1564790400", + "volume": "6996.11722818" + }, + { + "close": "10986.96", + "high": "11085.99", + "low": "10564.96", + "open": "10812.58", + "timestamp": "1564876800", + "volume": "7556.32923024" + }, + { + "close": "11800.00", + "high": "11959.36", + "low": "10986.55", + "open": "10986.55", + "timestamp": "1564963200", + "volume": "17260.45577332" + }, + { + "close": "11470.00", + "high": "12325.00", + "low": "11200.00", + "open": "11800.00", + "timestamp": "1565049600", + "volume": "16420.57916354" + }, + { + "close": "11971.57", + "high": "12145.42", + "low": "11388.01", + "open": "11471.58", + "timestamp": "1565136000", + "volume": "15480.45524249" + }, + { + "close": "11983.43", + "high": "12061.10", + "low": "11450.93", + "open": "11973.46", + "timestamp": "1565222400", + "volume": "10144.46210884" + }, + { + "close": "11859.32", + "high": "12040.00", + "low": "11650.00", + "open": "11985.60", + "timestamp": "1565308800", + "volume": "7336.91484905" + }, + { + "close": "11273.20", + "high": "11976.68", + "low": "11200.00", + "open": "11859.32", + "timestamp": "1565395200", + "volume": "7447.24834124" + }, + { + "close": "11528.73", + "high": "11589.73", + "low": "11080.37", + "open": "11273.03", + "timestamp": "1565481600", + "volume": "4361.39069182" + }, + { + "close": "11385.11", + "high": "11551.57", + "low": "11194.04", + "open": "11527.44", + "timestamp": "1565568000", + "volume": "3417.70935664" + }, + { + "close": "10862.28", + "high": "11446.94", + "low": "10738.58", + "open": "11380.61", + "timestamp": "1565654400", + "volume": "9003.17888634" + }, + { + "close": "10022.99", + "high": "10862.25", + "low": "9888.57", + "open": "10862.25", + "timestamp": "1565740800", + "volume": "12678.94119470" + }, + { + "close": "10301.44", + "high": "10444.66", + "low": "9467.57", + "open": "10022.50", + "timestamp": "1565827200", + "volume": "15083.17326332" + }, + { + "close": "10354.34", + "high": "10540.00", + "low": "9736.96", + "open": "10294.90", + "timestamp": "1565913600", + "volume": "11080.39966131" + }, + { + "close": "10210.89", + "high": "10472.93", + "low": "9974.51", + "open": "10351.18", + "timestamp": "1566000000", + "volume": "3907.52839849" + }, + { + "close": "10318.99", + "high": "10515.00", + "low": "10065.41", + "open": "10221.94", + "timestamp": "1566086400", + "volume": "3398.41986671" + }, + { + "close": "10927.30", + "high": "10940.00", + "low": "10267.56", + "open": "10318.99", + "timestamp": "1566172800", + "volume": "8044.02134828" + }, + { + "close": "10772.22", + "high": "10955.48", + "low": "10549.74", + "open": "10927.30", + "timestamp": "1566259200", + "volume": "5883.59995275" + }, + { + "close": "10134.75", + "high": "10807.54", + "low": "9853.45", + "open": "10778.75", + "timestamp": "1566345600", + "volume": "9812.62171129" + }, + { + "close": "10112.01", + "high": "10238.29", + "low": "9755.53", + "open": "10123.56", + "timestamp": "1566432000", + "volume": "6710.30664788" + }, + { + "close": "10401.60", + "high": "10479.00", + "low": "10051.00", + "open": "10112.45", + "timestamp": "1566518400", + "volume": "5557.29144342" + }, + { + "close": "10149.70", + "high": "10432.00", + "low": "9885.48", + "open": "10401.87", + "timestamp": "1566604800", + "volume": "5106.55673687" + }, + { + "close": "10136.75", + "high": "10355.89", + "low": "9907.86", + "open": "10149.38", + "timestamp": "1566691200", + "volume": "3953.39528117" + }, + { + "close": "10360.97", + "high": "10650.00", + "low": "10136.75", + "open": "10136.75", + "timestamp": "1566777600", + "volume": "7166.67534085" + }, + { + "close": "10167.29", + "high": "10375.53", + "low": "10019.10", + "open": "10355.11", + "timestamp": "1566864000", + "volume": "4781.33502180" + }, + { + "close": "9711.78", + "high": "10280.71", + "low": "9555.00", + "open": "10171.39", + "timestamp": "1566950400", + "volume": "9303.15591906" + }, + { + "close": "9490.00", + "high": "9720.20", + "low": "9320.00", + "open": "9720.20", + "timestamp": "1567036800", + "volume": "7717.10637568" + }, + { + "close": "9579.75", + "high": "9700.00", + "low": "9350.10", + "open": "9490.56", + "timestamp": "1567123200", + "volume": "5317.30970010" + }, + { + "close": "9594.15", + "high": "9682.73", + "low": "9443.19", + "open": "9569.30", + "timestamp": "1567209600", + "volume": "1572.15542709" + }, + { + "close": "9767.53", + "high": "9832.00", + "low": "9538.75", + "open": "9593.50", + "timestamp": "1567296000", + "volume": "1799.36720121" + }, + { + "close": "10384.48", + "high": "10471.00", + "low": "9753.24", + "open": "9767.56", + "timestamp": "1567382400", + "volume": "6144.79883515" + }, + { + "close": "10617.61", + "high": "10783.00", + "low": "10286.00", + "open": "10384.07", + "timestamp": "1567468800", + "volume": "11443.53849727" + }, + { + "close": "10586.26", + "high": "10834.15", + "low": "10378.70", + "open": "10617.72", + "timestamp": "1567555200", + "volume": "10088.72363010" + }, + { + "close": "10573.66", + "high": "10664.13", + "low": "10461.97", + "open": "10586.26", + "timestamp": "1567641600", + "volume": "4555.62463429" + }, + { + "close": "10311.09", + "high": "10949.00", + "low": "10204.18", + "open": "10573.04", + "timestamp": "1567728000", + "volume": "10701.50994422" + }, + { + "close": "10484.39", + "high": "10580.00", + "low": "10297.58", + "open": "10309.04", + "timestamp": "1567814400", + "volume": "3148.50895336" + }, + { + "close": "10400.18", + "high": "10594.88", + "low": "10229.49", + "open": "10497.57", + "timestamp": "1567900800", + "volume": "3130.86103548" + }, + { + "close": "10307.45", + "high": "10542.93", + "low": "10060.00", + "open": "10387.33", + "timestamp": "1567987200", + "volume": "6059.76274364" + }, + { + "close": "10096.00", + "high": "10390.09", + "low": "9910.00", + "open": "10317.62", + "timestamp": "1568073600", + "volume": "4658.92141056" + }, + { + "close": "10154.46", + "high": "10243.01", + "low": "9855.11", + "open": "10093.39", + "timestamp": "1568160000", + "volume": "4614.34849343" + }, + { + "close": "10420.34", + "high": "10465.00", + "low": "10027.52", + "open": "10163.81", + "timestamp": "1568246400", + "volume": "4719.04668642" + }, + { + "close": "10368.65", + "high": "10458.13", + "low": "10153.87", + "open": "10423.99", + "timestamp": "1568332800", + "volume": "3755.41742244" + }, + { + "close": "10355.37", + "high": "10441.47", + "low": "10217.01", + "open": "10365.81", + "timestamp": "1568419200", + "volume": "2656.15453049" + }, + { + "close": "10305.74", + "high": "10383.20", + "low": "10258.49", + "open": "10362.52", + "timestamp": "1568505600", + "volume": "2297.72276878" + }, + { + "close": "10269.98", + "high": "10378.07", + "low": "10060.95", + "open": "10320.36", + "timestamp": "1568592000", + "volume": "5496.03749388" + }, + { + "close": "10195.73", + "high": "10280.53", + "low": "10130.59", + "open": "10257.20", + "timestamp": "1568678400", + "volume": "5078.59865576" + }, + { + "close": "10152.09", + "high": "10263.65", + "low": "10080.00", + "open": "10182.96", + "timestamp": "1568764800", + "volume": "3952.00683587" + }, + { + "close": "10271.53", + "high": "10380.07", + "low": "9600.00", + "open": "10161.59", + "timestamp": "1568851200", + "volume": "7455.91141166" + }, + { + "close": "10169.02", + "high": "10308.04", + "low": "10055.00", + "open": "10284.72", + "timestamp": "1568937600", + "volume": "4463.38202069" + }, + { + "close": "9985.28", + "high": "10180.43", + "low": "9913.35", + "open": "10169.02", + "timestamp": "1569024000", + "volume": "4148.89981496" + }, + { + "close": "10020.58", + "high": "10093.24", + "low": "9842.35", + "open": "9973.00", + "timestamp": "1569110400", + "volume": "3213.95409570" + }, + { + "close": "9682.19", + "high": "10048.06", + "low": "9606.00", + "open": "10022.38", + "timestamp": "1569196800", + "volume": "5447.96313246" + }, + { + "close": "8536.82", + "high": "9782.00", + "low": "7998.00", + "open": "9685.69", + "timestamp": "1569283200", + "volume": "28154.41355726" + }, + { + "close": "8432.16", + "high": "8746.83", + "low": "8216.00", + "open": "8536.71", + "timestamp": "1569369600", + "volume": "17435.86789130" + }, + { + "close": "8055.03", + "high": "8467.89", + "low": "7733.99", + "open": "8443.44", + "timestamp": "1569456000", + "volume": "16662.32021152" + }, + { + "close": "8187.72", + "high": "8294.04", + "low": "7866.00", + "open": "8055.25", + "timestamp": "1569542400", + "volume": "10165.85293694" + }, + { + "close": "8218.07", + "high": "8356.40", + "low": "8009.84", + "open": "8199.96", + "timestamp": "1569628800", + "volume": "6315.48953894" + }, + { + "close": "8047.60", + "high": "8244.07", + "low": "7902.66", + "open": "8218.07", + "timestamp": "1569715200", + "volume": "5366.57071770" + }, + { + "close": "8298.45", + "high": "8368.50", + "low": "7714.70", + "open": "8060.13", + "timestamp": "1569801600", + "volume": "9518.99210777" + }, + { + "close": "8319.01", + "high": "8531.25", + "low": "8195.42", + "open": "8304.47", + "timestamp": "1569888000", + "volume": "10224.59198253" + }, + { + "close": "8373.42", + "high": "8393.39", + "low": "8170.91", + "open": "8326.41", + "timestamp": "1569974400", + "volume": "4952.53411520" + }, + { + "close": "8239.92", + "high": "8419.23", + "low": "8029.14", + "open": "8377.68", + "timestamp": "1570060800", + "volume": "8701.12039607" + }, + { + "close": "8152.07", + "high": "8244.93", + "low": "7986.65", + "open": "8243.39", + "timestamp": "1570147200", + "volume": "6278.78141904" + }, + { + "close": "8145.17", + "high": "8195.00", + "low": "8016.26", + "open": "8157.89", + "timestamp": "1570233600", + "volume": "4445.10406787" + }, + { + "close": "7854.12", + "high": "8176.46", + "low": "7772.71", + "open": "8150.73", + "timestamp": "1570320000", + "volume": "6454.53572694" + }, + { + "close": "8205.53", + "high": "8313.70", + "low": "7763.54", + "open": "7863.75", + "timestamp": "1570406400", + "volume": "9363.32718459" + }, + { + "close": "8178.54", + "high": "8344.12", + "low": "8109.74", + "open": "8211.04", + "timestamp": "1570492800", + "volume": "3577.72287319" + }, + { + "close": "8586.34", + "high": "8707.80", + "low": "8110.00", + "open": "8185.85", + "timestamp": "1570579200", + "volume": "11634.19484623" + }, + { + "close": "8582.11", + "high": "8666.84", + "low": "8450.61", + "open": "8586.57", + "timestamp": "1570665600", + "volume": "7435.43199033" + }, + { + "close": "8265.55", + "high": "8820.00", + "low": "8222.88", + "open": "8589.08", + "timestamp": "1570752000", + "volume": "7824.58718752" + }, + { + "close": "8303.43", + "high": "8427.76", + "low": "8254.68", + "open": "8265.16", + "timestamp": "1570838400", + "volume": "1828.83312447" + }, + { + "close": "8282.96", + "high": "8474.48", + "low": "8132.91", + "open": "8303.43", + "timestamp": "1570924800", + "volume": "4445.28381368" + }, + { + "close": "8362.99", + "high": "8416.67", + "low": "8215.41", + "open": "8278.39", + "timestamp": "1571011200", + "volume": "4294.60738920" + }, + { + "close": "8155.13", + "high": "8420.85", + "low": "8086.00", + "open": "8353.33", + "timestamp": "1571097600", + "volume": "5044.66127938" + }, + { + "close": "7995.89", + "high": "8179.10", + "low": "7912.66", + "open": "8162.45", + "timestamp": "1571184000", + "volume": "8644.40011646" + }, + { + "close": "8073.32", + "high": "8130.71", + "low": "7936.71", + "open": "7995.73", + "timestamp": "1571270400", + "volume": "5395.88599206" + }, + { + "close": "7955.08", + "high": "8120.77", + "low": "7811.62", + "open": "8069.26", + "timestamp": "1571356800", + "volume": "5611.09353737" + }, + { + "close": "7960.49", + "high": "8096.76", + "low": "7875.00", + "open": "7950.48", + "timestamp": "1571443200", + "volume": "3461.12529207" + }, + { + "close": "8235.74", + "high": "8314.77", + "low": "7874.68", + "open": "7965.39", + "timestamp": "1571529600", + "volume": "6358.92499072" + }, + { + "close": "8213.65", + "high": "8352.00", + "low": "8156.00", + "open": "8236.49", + "timestamp": "1571616000", + "volume": "4919.73416831" + }, + { + "close": "8025.90", + "high": "8314.77", + "low": "7989.15", + "open": "8206.53", + "timestamp": "1571702400", + "volume": "5678.93483059" + }, + { + "close": "7470.77", + "high": "8052.04", + "low": "7293.55", + "open": "8021.57", + "timestamp": "1571788800", + "volume": "13306.18266092" + }, + { + "close": "7435.00", + "high": "7512.00", + "low": "7356.00", + "open": "7470.77", + "timestamp": "1571875200", + "volume": "4997.42309350" + }, + { + "close": "8662.66", + "high": "8784.29", + "low": "7393.14", + "open": "7427.00", + "timestamp": "1571961600", + "volume": "19113.79549622" + }, + { + "close": "9252.75", + "high": "10350.00", + "low": "8642.46", + "open": "8677.09", + "timestamp": "1572048000", + "volume": "38751.80025476" + }, + { + "close": "9557.08", + "high": "9819.92", + "low": "9092.66", + "open": "9262.72", + "timestamp": "1572134400", + "volume": "17783.02515594" + }, + { + "close": "9216.44", + "high": "9950.00", + "low": "9177.84", + "open": "9547.32", + "timestamp": "1572220800", + "volume": "14722.01859796" + }, + { + "close": "9426.94", + "high": "9573.35", + "low": "9051.48", + "open": "9216.39", + "timestamp": "1572307200", + "volume": "9059.61157854" + }, + { + "close": "9159.94", + "high": "9437.06", + "low": "8985.25", + "open": "9426.94", + "timestamp": "1572393600", + "volume": "8814.43804818" + }, + { + "close": "9150.07", + "high": "9438.61", + "low": "8961.53", + "open": "9169.55", + "timestamp": "1572480000", + "volume": "10113.15940929" + }, + { + "close": "9250.45", + "high": "9303.53", + "low": "9054.60", + "open": "9158.08", + "timestamp": "1572566400", + "volume": "6640.55238456" + }, + { + "close": "9304.75", + "high": "9396.91", + "low": "9201.19", + "open": "9250.70", + "timestamp": "1572652800", + "volume": "2701.13696278" + }, + { + "close": "9207.00", + "high": "9384.32", + "low": "9067.00", + "open": "9304.75", + "timestamp": "1572739200", + "volume": "2539.21833111" + }, + { + "close": "9410.76", + "high": "9586.50", + "low": "9122.33", + "open": "9207.00", + "timestamp": "1572825600", + "volume": "4962.44231548" + }, + { + "close": "9320.14", + "high": "9485.00", + "low": "9165.20", + "open": "9410.76", + "timestamp": "1572912000", + "volume": "4979.57899177" + }, + { + "close": "9344.78", + "high": "9448.19", + "low": "9254.68", + "open": "9319.10", + "timestamp": "1572998400", + "volume": "4670.23465673" + }, + { + "close": "9199.36", + "high": "9373.48", + "low": "9080.00", + "open": "9346.02", + "timestamp": "1573084800", + "volume": "3975.97661681" + }, + { + "close": "8767.37", + "high": "9253.39", + "low": "8661.00", + "open": "9209.30", + "timestamp": "1573171200", + "volume": "9699.74677043" + }, + { + "close": "8812.21", + "high": "8876.94", + "low": "8720.00", + "open": "8760.38", + "timestamp": "1573257600", + "volume": "2271.51792167" + }, + { + "close": "9024.49", + "high": "9142.33", + "low": "8750.85", + "open": "8806.85", + "timestamp": "1573344000", + "volume": "2663.27825012" + }, + { + "close": "8720.36", + "high": "9075.32", + "low": "8593.00", + "open": "9029.88", + "timestamp": "1573430400", + "volume": "6392.97505953" + }, + { + "close": "8813.91", + "high": "8872.47", + "low": "8549.00", + "open": "8720.36", + "timestamp": "1573516800", + "volume": "4721.90610684" + }, + { + "close": "8755.24", + "high": "8839.46", + "low": "8700.00", + "open": "8817.00", + "timestamp": "1573603200", + "volume": "3185.82098874" + }, + { + "close": "8636.90", + "high": "8791.78", + "low": "8555.00", + "open": "8765.53", + "timestamp": "1573689600", + "volume": "3412.80581524" + }, + { + "close": "8463.49", + "high": "8799.03", + "low": "8363.00", + "open": "8632.07", + "timestamp": "1573776000", + "volume": "5213.70141434" + }, + { + "close": "8484.63", + "high": "8539.53", + "low": "8423.00", + "open": "8459.38", + "timestamp": "1573862400", + "volume": "1180.57339029" + }, + { + "close": "8499.31", + "high": "8631.60", + "low": "8375.00", + "open": "8485.61", + "timestamp": "1573948800", + "volume": "2074.00770126" + }, + { + "close": "8170.65", + "high": "8508.40", + "low": "8010.70", + "open": "8499.53", + "timestamp": "1574035200", + "volume": "4825.65562506" + }, + { + "close": "8121.63", + "high": "8197.77", + "low": "7989.15", + "open": "8176.90", + "timestamp": "1574121600", + "volume": "4412.39464174" + }, + { + "close": "8088.44", + "high": "8231.04", + "low": "8027.28", + "open": "8124.08", + "timestamp": "1574208000", + "volume": "2996.00619203" + }, + { + "close": "7611.51", + "high": "8116.92", + "low": "7394.09", + "open": "8085.54", + "timestamp": "1574294400", + "volume": "9374.99957046" + }, + { + "close": "7285.85", + "high": "7714.70", + "low": "6785.00", + "open": "7612.23", + "timestamp": "1574380800", + "volume": "20120.14646602" + }, + { + "close": "7320.39", + "high": "7356.49", + "low": "7102.16", + "open": "7276.21", + "timestamp": "1574467200", + "volume": "5550.47222776" + }, + { + "close": "6908.36", + "high": "7349.68", + "low": "6861.96", + "open": "7330.98", + "timestamp": "1574553600", + "volume": "6047.01776023" + }, + { + "close": "7122.14", + "high": "7380.00", + "low": "6515.00", + "open": "6900.90", + "timestamp": "1574640000", + "volume": "18716.60131311" + }, + { + "close": "7159.22", + "high": "7344.91", + "low": "7018.78", + "open": "7127.12", + "timestamp": "1574726400", + "volume": "7643.84956815" + }, + { + "close": "7527.84", + "high": "7676.27", + "low": "6847.72", + "open": "7168.74", + "timestamp": "1574812800", + "volume": "15156.99193450" + }, + { + "close": "7436.72", + "high": "7659.92", + "low": "7372.19", + "open": "7517.82", + "timestamp": "1574899200", + "volume": "6925.58489749" + }, + { + "close": "7753.69", + "high": "7870.35", + "low": "7411.17", + "open": "7429.32", + "timestamp": "1574985600", + "volume": "7658.87160206" + }, + { + "close": "7550.67", + "high": "7815.00", + "low": "7452.08", + "open": "7753.69", + "timestamp": "1575072000", + "volume": "5446.27351349" + }, + { + "close": "7412.66", + "high": "7560.20", + "low": "7233.87", + "open": "7560.20", + "timestamp": "1575158400", + "volume": "5477.97290774" + }, + { + "close": "7309.64", + "high": "7431.07", + "low": "7140.08", + "open": "7411.75", + "timestamp": "1575244800", + "volume": "4324.30016255" + }, + { + "close": "7300.43", + "high": "7415.00", + "low": "7238.04", + "open": "7317.94", + "timestamp": "1575331200", + "volume": "2552.20229834" + }, + { + "close": "7197.78", + "high": "7772.71", + "low": "7087.09", + "open": "7299.20", + "timestamp": "1575417600", + "volume": "7737.39153487" + }, + { + "close": "7390.42", + "high": "7500.00", + "low": "7150.06", + "open": "7199.58", + "timestamp": "1575504000", + "volume": "4641.75678879" + }, + { + "close": "7541.79", + "high": "7618.99", + "low": "7305.56", + "open": "7397.35", + "timestamp": "1575590400", + "volume": "4167.24016320" + }, + { + "close": "7502.65", + "high": "7638.88", + "low": "7486.70", + "open": "7535.46", + "timestamp": "1575676800", + "volume": "2034.57371900" + }, + { + "close": "7524.26", + "high": "7580.00", + "low": "7382.69", + "open": "7505.86", + "timestamp": "1575763200", + "volume": "1798.77041268" + }, + { + "close": "7340.52", + "high": "7666.00", + "low": "7268.03", + "open": "7516.80", + "timestamp": "1575849600", + "volume": "6582.47031165" + }, + { + "close": "7216.07", + "high": "7400.00", + "low": "7150.23", + "open": "7332.05", + "timestamp": "1575936000", + "volume": "4090.62092926" + }, + { + "close": "7207.42", + "high": "7271.00", + "low": "7122.28", + "open": "7224.50", + "timestamp": "1576022400", + "volume": "3419.93896517" + }, + { + "close": "7188.42", + "high": "7296.19", + "low": "7072.20", + "open": "7208.95", + "timestamp": "1576108800", + "volume": "4376.88899274" + }, + { + "close": "7257.47", + "high": "7302.35", + "low": "7179.65", + "open": "7185.15", + "timestamp": "1576195200", + "volume": "3178.07849595" + }, + { + "close": "7059.03", + "high": "7269.00", + "low": "7007.48", + "open": "7255.94", + "timestamp": "1576281600", + "volume": "2012.34890643" + }, + { + "close": "7115.08", + "high": "7225.23", + "low": "7007.00", + "open": "7066.35", + "timestamp": "1576368000", + "volume": "1848.34572822" + }, + { + "close": "6882.19", + "high": "7147.91", + "low": "6820.00", + "open": "7115.08", + "timestamp": "1576454400", + "volume": "5923.05547919" + }, + { + "close": "6612.30", + "high": "6938.77", + "low": "6550.00", + "open": "6882.08", + "timestamp": "1576540800", + "volume": "7107.25638535" + }, + { + "close": "7286.91", + "high": "7449.68", + "low": "6425.00", + "open": "6619.53", + "timestamp": "1576627200", + "volume": "12873.63439214" + }, + { + "close": "7149.57", + "high": "7372.12", + "low": "7000.00", + "open": "7286.91", + "timestamp": "1576713600", + "volume": "5936.55634536" + }, + { + "close": "7194.11", + "high": "7218.11", + "low": "7072.61", + "open": "7157.53", + "timestamp": "1576800000", + "volume": "3201.66392251" + }, + { + "close": "7147.40", + "high": "7194.13", + "low": "7109.73", + "open": "7194.13", + "timestamp": "1576886400", + "volume": "1689.08199513" + }, + { + "close": "7509.70", + "high": "7530.00", + "low": "7124.52", + "open": "7147.40", + "timestamp": "1576972800", + "volume": "3796.22608082" + }, + { + "close": "7316.17", + "high": "7692.98", + "low": "7247.86", + "open": "7521.88", + "timestamp": "1577059200", + "volume": "6710.76736040" + }, + { + "close": "7251.52", + "high": "7431.10", + "low": "7156.00", + "open": "7317.47", + "timestamp": "1577145600", + "volume": "4194.58980335" + }, + { + "close": "7195.79", + "high": "7266.81", + "low": "7110.73", + "open": "7247.45", + "timestamp": "1577232000", + "volume": "1504.52751296" + }, + { + "close": "7188.30", + "high": "7432.00", + "low": "7150.00", + "open": "7195.80", + "timestamp": "1577318400", + "volume": "3116.74715162" + }, + { + "close": "7246.00", + "high": "7255.37", + "low": "7052.00", + "open": "7195.17", + "timestamp": "1577404800", + "volume": "4024.57086599" + }, + { + "close": "7296.24", + "high": "7349.65", + "low": "7231.00", + "open": "7247.70", + "timestamp": "1577491200", + "volume": "1579.70272647" + }, + { + "close": "7385.54", + "high": "7524.46", + "low": "7274.43", + "open": "7297.43", + "timestamp": "1577577600", + "volume": "2583.85134193" + }, + { + "close": "7220.24", + "high": "7384.90", + "low": "7199.00", + "open": "7372.79", + "timestamp": "1577664000", + "volume": "3722.91334933" + }, + { + "close": "7168.36", + "high": "7302.35", + "low": "7112.55", + "open": "7222.74", + "timestamp": "1577750400", + "volume": "2638.69130899" + }, + { + "close": "7178.68", + "high": "7237.35", + "low": "7150.00", + "open": "7160.69", + "timestamp": "1577836800", + "volume": "1119.10969318" + } + ], + "pair": "BTC/USD" + } + }, + "queryString": "end=1577836800\u0026limit=1000\u0026start=1546300800\u0026step=86400", + "bodyParams": "", + "headers": { + "Referer": [ + "https://www.bitstamp.net/api/v2/ohlc/btcusd?end=1577836800\u0026limit=1000\u0026start=1546300800\u0026step=86400" + ] + } } ] },