<commit_before>var Immutable = require("immutable");
var alt = require("../alt-instance");
var MarketsActions = require("../actions/MarketsActions");
var SettingsActions = require("../actions/SettingsActions");
var market_utils = require("../common/market_utils");
import ChainStore from "api/ChainStore";
import utils from "common/utils";

import {
    LimitOrder,
    ShortOrder,
    CallOrder,
    SettleOrder
}
from "./tcomb_structs";

var ls = typeof localStorage === "undefined" ? null : localStorage;

class MarketsStore {
    constructor() {
        this.markets = Immutable.Map();
        this.asset_symbol_to_id = {};
        this.pendingOrders = Immutable.Map();
        this.activeMarketLimits = Immutable.Map();
        this.activeMarketCalls = Immutable.Map();
        this.activeMarketSettles = Immutable.Map();
        this.activeMarketHistory = Immutable.OrderedSet();
        this.bids = [];
        this.asks = [];
        this.calls = [];
        this.flat_bids = [];
        this.totalBids = 0;
        this.totalCalls = 0;
        this.flat_asks = [];
        this.priceData = [];
        this.volumeData = [];
        this.pendingCreateLimitOrders = [];
        this.activeMarket = null;
        this.inverseMarket = true;
        this.quoteAsset = null;
        this.pendingCounter = 0;
        this.buckets = [15,60,300,3600,86400];
        this.bucketSize = this._getBucketSize();
        this.priceHistory = [];
        this.lowestCallPrice = null;
        this.marketBase = "CORE";
        this.baseAsset = {
            id: "1.3.0",
            symbol: "CORE",
            precision: 5
        };

        this.coreAsset = {
            id: "1.3.0",
            symbol: "CORE",
            precision: 5
        };

        this.bindListeners({
            onSubscribeMarket: MarketsActions.subscribeMarket,
            onUnSubscribeMarket: MarketsActions.unSubscribeMarket,
            onGetMarkets: MarketsActions.getMarkets,
            onChangeBase: MarketsActions.changeBase,
            onInverseMarket: SettingsActions.changeSetting,
            onChangeBucketSize: MarketsActions.changeBucketSize,
            onCancelLimitOrderSuccess: MarketsActions.cancelLimitOrderSuccess,
            onCloseCallOrderSuccess: MarketsActions.closeCallOrderSuccess,
            onCallOrderUpdate: MarketsActions.callOrderUpdate,
            onClearMarket: MarketsActions.clearMarket
        });
    }

    onGetCollateralPositions(payload) {
        this.borrowMarketState = {
            totalDebt: payload.totalDebt,
            totalCollateral: payload.totalCollateral
        };
    }

    _getBucketSize() {
        let bs = ls ? ls.getItem("__graphene___bucketSize") : null;
        return bs ? parseInt(bs) : 300;
    }

    _setBucketSize(size) {
        this.bucketSize = size;
        if (ls) {
            ls.setItem("__graphene___bucketSize", size);
        }
    }

    onInverseMarket(payload) {
        if (payload.setting === "inverseMarket") {
            this.inverseMarket = payload.value;<commit_msg>Increase default bucketsize to 1hr<commit_after>var Immutable = require("immutable");
var alt = require("../alt-instance");
var MarketsActions = require("../actions/MarketsActions");
var SettingsActions = require("../actions/SettingsActions");
var market_utils = require("../common/market_utils");
import ChainStore from "api/ChainStore";
import utils from "common/utils";

import {
    LimitOrder,
    ShortOrder,
    CallOrder,
    SettleOrder
}
from "./tcomb_structs";

var ls = typeof localStorage === "undefined" ? null : localStorage;

class MarketsStore {
    constructor() {
        this.markets = Immutable.Map();
        this.asset_symbol_to_id = {};
        this.pendingOrders = Immutable.Map();
        this.activeMarketLimits = Immutable.Map();
        this.activeMarketCalls = Immutable.Map();
        this.activeMarketSettles = Immutable.Map();
        this.activeMarketHistory = Immutable.OrderedSet();
        this.bids = [];
        this.asks = [];
        this.calls = [];
        this.flat_bids = [];
        this.totalBids = 0;
        this.totalCalls = 0;
        this.flat_asks = [];
        this.priceData = [];
        this.volumeData = [];
        this.pendingCreateLimitOrders = [];
        this.activeMarket = null;
        this.inverseMarket = true;
        this.quoteAsset = null;
        this.pendingCounter = 0;
        this.buckets = [15,60,300,3600,86400];
        this.bucketSize = this._getBucketSize();
        this.priceHistory = [];
        this.lowestCallPrice = null;
        this.marketBase = "CORE";
        this.baseAsset = {
            id: "1.3.0",
            symbol: "CORE",
            precision: 5
        };

        this.coreAsset = {
            id: "1.3.0",
            symbol: "CORE",
            precision: 5
        };

        this.bindListeners({
            onSubscribeMarket: MarketsActions.subscribeMarket,
            onUnSubscribeMarket: MarketsActions.unSubscribeMarket,
            onGetMarkets: MarketsActions.getMarkets,
            onChangeBase: MarketsActions.changeBase,
            onInverseMarket: SettingsActions.changeSetting,
            onChangeBucketSize: MarketsActions.changeBucketSize,
            onCancelLimitOrderSuccess: MarketsActions.cancelLimitOrderSuccess,
            onCloseCallOrderSuccess: MarketsActions.closeCallOrderSuccess,
            onCallOrderUpdate: MarketsActions.callOrderUpdate,
            onClearMarket: MarketsActions.clearMarket
        });
    }

    onGetCollateralPositions(payload) {
        this.borrowMarketState = {
            totalDebt: payload.totalDebt,
            totalCollateral: payload.totalCollateral
        };
    }

    _getBucketSize() {
        let bs = ls ? ls.getItem("__graphene___bucketSize") : null;
        return bs ? parseInt(bs) : 3600;
    }

    _setBucketSize(size) {
        this.bucketSize = size;
        if (ls) {
            ls.setItem("__graphene___bucketSize", size);
        }
    }

    onInverseMarket(payload) {
        if (payload.setting === "inverseMarket") {
            this.inverseMarket = payload.value;
{'fraction_non_alphanumeric': 0.11169341631182443, 'fraction_numerical': 0.010153946937438586, 'mean_word_length': 2.2992976769313884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6619449', 'n_tokens_mistral': 1815, 'n_tokens_neox': 1681, 'n_words': 295}