コード例 #1
0
def test_check_limit_max():
    assert check_limit_max(0) == 0
    assert check_limit_max(None) == None
    assert check_limit_max(limit=500, limit_max=1000) == 500
    assert check_limit_max(limit=1000, limit_max=1000) == 1000
    with pytest.raises(ValueError):
        assert check_limit_max(limit=2000, limit_max=1000)
コード例 #2
0
    async def trades(
            self,
            symbol: str,
            start_time: int = None,
            end_time: int = None,
            from_id: int = None,
            limit: int = None,
            recv_window: int = None,
    ):
        """Get trades for a specific account and symbol.

        https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#account-trade-list-user_data
        """
        return await self._get(
            'myTrades',
            sign=True,
            params={
                'symbol': symbol,
                'fromId': from_id,
                'startTime': start_time,
                'endTime': end_time,
                'limit': check_limit_max(limit),
                'recvWindow': recv_window,
            },
            version=ApiVersion.V3
        )
コード例 #3
0
    async def all_orders(
            self,
            symbol: str,
            order_id: int = None,
            start_time: int = None,
            end_time: int = None,
            limit: int = None,
            recv_window: int = None,
    ):
        """Get all account orders; active, canceled, or filled.

        https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#all-orders-user_data
        """
        return await self._get(
            'allOrders',
            sign=True,
            params={
                'symbol': symbol,
                'orderId': order_id,
                'startTime': start_time,
                'endTime': end_time,
                'limit': check_limit_max(limit),
                'recvWindow': recv_window,
            },
            version=ApiVersion.V3
        )
コード例 #4
0
ファイル: market.py プロジェクト: ape364/aiobinance
    async def recent_trades(self,
                            symbol: str,
                            limit: int = None) -> List[Dict[str, Any]]:
        """Get recent trades (up to last 500).

        https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#recent-trades-list
        """
        return await self._get('trades',
                               params={
                                   'symbol': symbol,
                                   'limit': check_limit_max(limit)
                               })
コード例 #5
0
ファイル: market.py プロジェクト: ape364/aiobinance
    async def historical_trades(self,
                                symbol: str,
                                limit: int = None,
                                from_id: int = None) -> List[Dict[str, Any]]:
        """Get older trades.

        https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#old-trade-lookup-market_data
        """
        return await self._get('historicalTrades',
                               params={
                                   'symbol': symbol,
                                   'limit': check_limit_max(limit),
                                   'fromId': from_id
                               })
コード例 #6
0
ファイル: market.py プロジェクト: ape364/aiobinance
    async def agg_trades(self,
                         symbol: str,
                         from_id: int = None,
                         start_time: int = None,
                         end_time: int = None,
                         limit: int = None) -> Dict:
        """Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.

        https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#compressedaggregate-trades-list
        """
        return await self._get('historicalTrades',
                               params={
                                   'symbol': symbol,
                                   'fromId': from_id,
                                   'startTime': start_time,
                                   'endTime': end_time,
                                   'limit': check_limit_max(limit),
                               })