# @author: lj
import random
import time
import pytest
import requests
import logging

from swagger_client.main.api.entrust_api import EntrustApi  # noqa: E501
from swagger_client.main.configuration import Configuration
from swagger_client.main.models.post_entrusts_request import PostEntrustsRequest
from .data import (FIELDS, get_random_price_and_volume, test_data30,
                   test_data31, test_data32, test_data35, test_data33,
                   test_data36, test_data34, test_data37)

api = EntrustApi()
configuration = Configuration()

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler())


class TestFirstSellMultiDifferentPriceOneBuy:
    @pytest.mark.parametrize(FIELDS, [test_data30, test_data31])
    def test_multi_sell_volume_eq(
            self, market_id, price, entrust_type, trade_type, volume,
            trigger_price, auto_cancel_at, volume_flag, special_login):
        payload = PostEntrustsRequest()
        payload.price = 1000000
        payload.entrust_type = 'market'
        payload.trade_type = 'sell'
# -*- coding: utf-8 -*-
# @File :  test_stoploss_multi_differ_buy.py
# @Author : lh

import random
import time

import pytest

from swagger_client.main.api.entrust_api import EntrustApi  # noqa: E501
from swagger_client.main.api.account_api import AccountApi
from swagger_client.main.models.post_entrusts_request import PostEntrustsRequest
from .profitloss_data import FIELDS, stopprofit_multi_differ_buy, get_random_price_and_volume

main_entrust_api = EntrustApi()
main_ac_api = AccountApi()


class TestFirstBuyMultiDifferentPriceOneSell:
    # def teardown_method(self):
    #     result = main_entrust_api.entrusts_get(status=["entrusting"])
    #     for i in result.items:
    #         main_entrust_api.entrusts_id_cancel_post(i.order_id)

    @pytest.mark.parametrize(FIELDS, stopprofit_multi_differ_buy)
    def test_multi_sell_volume_eq(self, market_id, price, entrust_type,
                                  trade_type, volume, trigger_price,
                                  auto_cancel_at, entrust_special_login):
        # login
        special_info = entrust_special_login([main_entrust_api, main_ac_api])
        payload = PostEntrustsRequest()