def __init__(self, product_id='LTC-USD', log_to=None, gdax=None, auth=True): if gdax is None: from stocklook.crypto.gdax.api import Gdax gdax = Gdax() super(GdaxBookFeed, self).__init__(products=product_id, auth=auth, api_key=gdax.api_key, api_secret=gdax.api_secret, api_passphrase=gdax.api_passphrase) self._asks = None self._bids = None self._client = gdax self._sequence = -1 self._log_to = log_to if self._log_to: assert hasattr(self._log_to, 'write') self._current_ticker = None self._key_errs = 0 self._errs = 0 self.message_count = 0
import pytest, os from stocklook.crypto.gdax.chartdata import GdaxChartData from stocklook.crypto.gdax.api import Gdax from stocklook.utils.timetools import now_minus, now_plus gdax = Gdax() yesterday = now_minus(hours=6) today = now_plus(hours=12) FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') def test_chart_rsi(): fp = os.path.join(FIXTURES_DIR, 'btc_test_chart.csv') c = GdaxChartData(gdax, 'BTC-USD', yesterday, today, granularity=60*5,) c.df.to_csv(fp, index=False)
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ if __name__ == '__main__': import os from time import sleep from stocklook.crypto.gdax.api import Gdax from stocklook.crypto.gdax.chartdata import GdaxChartData from stocklook.crypto.gdax.market_maker import GdaxMarketMaker from stocklook.utils.timetools import now, now_minus from stocklook.config import config chart_path = os.path.join(config['DATA_DIRECTORY'], 'rsi_check.csv') g = Gdax() def export_chart(): d = GdaxChartData(g, 'ETH-USD', now_minus(days=1), now(), granularity=60*5,) d.df.to_csv(chart_path, index=False) m = GdaxMarketMaker(product_id='ETH-USD', gdax=g) m.book_feed.start() sleep(10) def adj_market(): for _ in range(2): m.adjust_to_market_conditions() sleep(5)