MCPcopy
hub / github.com/ZhengyaoJiang/PGPortfolio / api

Method api

pgportfolio/marketdata/poloniex.py:45–56  ·  view source on GitHub ↗

returns 'False' if invalid command or if no APIKey or Secret is specified (if command is "private") returns {"error":" "} if API error

(self, command, args={})

Source from the content-addressed store, hash-verified

43 # Main Api Function #
44 #####################
45 def api(self, command, args={}):
46 """
47 returns 'False' if invalid command or if no APIKey or Secret is specified (if command is "private")
48 returns {"error":"<error message>"} if API error
49 """
50 if command in PUBLIC_COMMANDS:
51 url = 'https://poloniex.com/public?'
52 args['command'] = command
53 ret = urlopen(Request(url + urlencode(args)))
54 return json.loads(ret.read().decode(encoding='UTF-8'))
55 else:
56 return False

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected