#!/usr/bin/python
__author__ = "donnydevito"
__copyright__   = "Copyright 2015, donnydevito"
__license__ = "MIT"
# Copyright (c) 2016 currentsea, Joseph Bull 

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# 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.
import requests, json, re, uuid, datetime, argparse, warnings, pytz
from elasticsearch import Elasticsearch
from time import sleep 

# ***** CHANGE THIS TO BE THE URL OF YOUR ELASTICSEARCH SERVER *****
ELASTICSEARCH_HOST = "http://localhost:9200"

# Bitfinex API time limit in seconds 
API_TIME_LIMIT = 1

# Default index name in elasticsearch to use for the btc_usd market data aggregation
DEFAULT_INDEX_NAME = "btctickerarchive"

# REST API URL for Bitfinex
BITFINEX_REST_API_URL = "https://api.bitfinex.com/v1"

# UTC ALL THE TIME, FOREVER AND EVER. 
TIMEZONE = pytz.timezone('UTC')

# REST API URL for Bitfinex US Dollars to Bitcoin (BTCUSD) Public Ticker
BITFINEX_BTCUSD_TICKER_REST_URL = BITFINEX_REST_API_URL + "/pubticker/BTCUSD"

# REST API URL for Bitfinex US Dollars to Litecoin (LTCUSD) Public Ticker
BITFINEX_LTCUSD_TICKER_REST_URL = BITFINEX_REST_API_URL + "/pubticker/LTCUSD"


BITFINEX_LTCBTC_TICKER_REST_URL = BITFINEX_REST_API_URL + "/pubticker/LTCBTC"

# REST API URL Root For Okcoin
OKCOIN_REST_API_URL = "https://www.okcoin.com/api/v1" 

# REST API URL for OkCoin Public Bitcoin (BTCUSD) Ticker
OKCOIN_BTCUSD_TICKER_REST_URL = OKCOIN_REST_API_URL + "/ticker.do?symbol=btc_usd"

def getArgs(): 
	parser = argparse.ArgumentParser(description='BTC elastic search data collector')
	parser.add_argument('--host', action='store_true', default=False)
	parser.add_argument('--forever', action='store_true', default=False)
	parser.add_argument('--max_records', action='store_true', default=3600)

	# TODO: add more params here

	args = parser.parse_args()
	return args