コード例 #1
0
ファイル: resources.py プロジェクト: jsloane/rotki
class ExchangesResource(BaseResource):

    put_schema = ExchangesResourceAddSchema()
    patch_schema = ExchangesResourceEditSchema()
    delete_schema = ExchangesResourceRemoveSchema()

    def get(self) -> Response:
        return self.rest_api.get_exchanges()

    @use_kwargs(put_schema, location='json')
    def put(
        self,
        name: str,
        location: Location,
        api_key: ApiKey,
        api_secret: ApiSecret,
        passphrase: Optional[str],
        kraken_account_type: Optional['KrakenAccountType'],
        binance_markets: Optional[List[str]],
        ftx_subaccount: Optional[str],
    ) -> Response:
        return self.rest_api.setup_exchange(
            name=name,
            location=location,
            api_key=api_key,
            api_secret=api_secret,
            passphrase=passphrase,
            kraken_account_type=kraken_account_type,
            binance_markets=binance_markets,
            ftx_subaccount_name=ftx_subaccount,
        )

    @use_kwargs(patch_schema, location='json')
    def patch(
        self,
        name: str,
        location: Location,
        new_name: Optional[str],
        api_key: Optional[ApiKey],
        api_secret: Optional[ApiSecret],
        passphrase: Optional[str],
        kraken_account_type: Optional['KrakenAccountType'],
        binance_markets: Optional[List[str]],
        ftx_subaccount: Optional[str],
    ) -> Response:
        return self.rest_api.edit_exchange(
            name=name,
            location=location,
            new_name=new_name,
            api_key=api_key,
            api_secret=api_secret,
            passphrase=passphrase,
            kraken_account_type=kraken_account_type,
            binance_markets=binance_markets,
            ftx_subaccount_name=ftx_subaccount,
        )

    @use_kwargs(delete_schema, location='json')
    def delete(self, name: str, location: Location) -> Response:
        return self.rest_api.remove_exchange(name=name, location=location)
コード例 #2
0
ファイル: resources.py プロジェクト: AndrewBezold/rotki
class ExchangesResource(BaseResource):

    put_schema = ExchangesResourceAddSchema()
    delete_schema = ExchangesResourceRemoveSchema()

    def get(self) -> Response:
        return self.rest_api.get_exchanges()

    @use_kwargs(put_schema, location='json')  # type: ignore
    def put(
            self,
            name: str,
            api_key: ApiKey,
            api_secret: ApiSecret,
            passphrase: Optional[str],
    ) -> Response:
        return self.rest_api.setup_exchange(name, api_key, api_secret, passphrase)

    @use_kwargs(delete_schema, location='json')  # type: ignore
    def delete(self, name: str) -> Response:
        return self.rest_api.remove_exchange(name=name)