Ejemplo n.º 1
0
    def closeAllPositions(self):
        #Get current open positions
        self.writeToLog("Closing all positions...")
        openPositions = FinexAPI.active_positions()
        self.writeToLog(openPositions)

        for pos in openPositions:
            id = json.loads(makeJSONReadable(str(pos)))['id']
            self.writeToLog(FinexAPI.close_position(id))

        self.writeToLog("All positions closed.")
Ejemplo n.º 2
0
    def getPosition(self):

        try:
            pos = makeJSONReadable(str(FinexAPI.active_positions()[0]))
            self.writeToLog(pos)
            pos = json.loads(pos)
            print pos['amount']
            if float(pos['amount']) > 0.0000001:
                self.positionType = "Long"
            elif float(pos['amount']) < -0.0000001:
                self.positionType = "Short"
        except:
            None
Ejemplo n.º 3
0
#!/usr/bin/env python
import FinexAPI

print FinexAPI.active_positions()