Exemplo n.º 1
0
def check_update():
	cur_version = cexbot.get_version(semantic=True)
	latest_version = get_latest()
	print "Current version: %s Latest version: %s" % (cur_version, latest_version)
	if latest_version:
		lv = semantic_version.Version(latest_version)
		cv = semantic_version.Version(cur_version)
		if lv > cv:
			logging.error("New version available, run git pull or pip -U cexbot")
	return None
Exemplo n.º 2
0
def check_update():
	cur_version = cexbot.get_version(semantic=True)
	latest_version = get_latest()
	print "Current version: %s" % cur_version
	print "Latest version : %s" % latest_version
	if latest_version:
		lv = semantic_version.Version(latest_version)
		cv = semantic_version.Version(cur_version)
		if lv > cv:
			print "New version available, run:"
			print " pip install -U cexbot"
			print "to update or see the homepage for"
			print "more information: "
			print " http://www.github.com/nikcub/cexbot/"
	return None
Exemplo n.º 3
0
def main(argv=[]):
  args = parser.get_parser()

  verbose = 1
  if args.verbose:
    verbose = 2
  if args.debug:
    verbose = 3

  if verbose>2:
    log_level=logging.DEBUG
  elif verbose==2:
    log_level=logging.INFO
  elif verbose==1:
    log_level=logging.WARNING
  elif verbose<1:
    log_level=logging.ERROR

  logging.basicConfig(level=log_level, format="%(asctime)s %(levelname)s: %(message)s")

  if args.command == 'version':
    print cexbot.get_version()
    return True

  # make sure this is always above command parsing
  # print config
  config.first_run()

  if verbose == 3:
    print args

  if args.command == 'config':
    if args.list:
      return config.list()
    elif args.edit:
      return config.edit_config()
    elif args.testauth:
      return config.test_auth()
    elif args.name and args.value:
      v = config.set(args.name, args.value)
      return config.cprint(args.name)
    elif args.name:
      return config.cprint(args.name)
    logging.error('Invalid config option')
    return 1

  elif args.command == 'update':
    return updater.check_update()

  # not implemented
  elif args.command == 'cleardata':
    return config.clear_userdata()


  ac = cexapi.CexAPI(config.get('cex.username'), config.get('cex.apikey'), config.get('cex.secret'))
  dbi = db.DbManager()
  cx = CexMethods(ac, dbi)

  if args.command == 'balance':
    print "Balance: %s BTC" % ac.get_balance()
    return True

  elif args.command == 'initdb':
    return dbi.initdb()

  elif args.command == 'getmarket':
    return ac.get_market()

  elif args.command == 'getprice':
    return ac.get_market_quote()

  elif args.command == 'order':
    amount = args.amount
    price = args.price
    r = ac.place_order(amount, price)
    logging.info("Ordered: %s" % r)

  elif args.command == 'updatequotes':
    logging.info('Running updatequotes')
    ticker_timer = timer.ReqTimer(2, cx.update_ticker)
    ticker_timer.start()

  elif args.command == 'buybalance':
    logging.info('Running buybalance')
    balance_timer = timer.ReqTimer(5, ac.buy_balance)
    balance_timer.start()
Exemplo n.º 4
0
package_dir = os.path.realpath(os.path.dirname(__file__))

def get_file_contents(file_path):
  """Get the context of the file using full path name"""
  full_path = os.path.join(package_dir, file_path)
  return open(full_path, 'r').read()

setup(
  name = 'cexbot',
  description = cexbot.__doc__.split('\n\n')[0],
  long_description = get_file_contents('README.md'),
  keywords = 'cexbot, bitcoin, finance',
  url = 'https://github.com/nikcub/cexbot',
  platforms = ['linux', 'osx'],
  version = cexbot.get_version(),
  author = 'Nik Cubrilovic',
  author_email = '*****@*****.**',
  license = get_file_contents('LICENSE'),
  install_requires = packages,
  packages = ['cexbot'],
  app=APP,
  data_files=DATA_FILES,
  options={'py2app': OPTIONS},
  setup_requires=['py2app'],
  scripts = scripts,
  # entry_points={
  #   'console_scripts': [
  #     "cexbot-cli = cexbot.command_utils:run_cl"
  #   ],
    # 'gui_scripts': [
Exemplo n.º 5
0

def get_file_contents(file_path):
    """Get the context of the file using full path name"""
    full_path = os.path.join(package_dir, file_path)
    return open(full_path, 'r').read()


setup(
    name='cexbot',
    description=cexbot.__doc__.split('\n\n')[0],
    long_description=get_file_contents('README.md'),
    keywords='cexbot, bitcoin, finance',
    url='https://github.com/nikcub/cexbot',
    platforms=['linux', 'osx'],
    version=cexbot.get_version(),
    author='Nik Cubrilovic',
    author_email='*****@*****.**',
    license=get_file_contents('LICENSE'),
    install_requires=packages,
    packages=['cexbot'],
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
    scripts=scripts,
    # entry_points={
    #   'console_scripts': [
    #     "cexbot-cli = cexbot.command_utils:run_cl"
    #   ],
    # 'gui_scripts': [