I've been trying to use the Bitfinex brokerage.  

I use getbuyingpower and carefully make sure no outstanding orders etc but still find orders returning with invalid status because insufficient margin on exchange to support trade.  

The algo reported margin remaining is significantly different to margin available reported by Bitfinex.

Is this an aspect of beta?

Has anyone encountered this and/or sorted with a order quantity calculation that works robustly?