修改: PriceSystem/CalcCmdReceiver.py
修改: PriceSystem/config/__init__.py 修改: PriceSystem/fix/__pycache__/price_fix.cpython-36.pyc 修改: PriceSystem/fix/price_fix.py 修改: PriceSystem/ones_Sender.py 修改: PriceSystem/sell_price/zhuge0118A.py 修改: PriceSystem/test.py
This commit is contained in:
@@ -10,8 +10,8 @@ import pytz
|
||||
import os
|
||||
|
||||
QUEUE = "calc_cmd"
|
||||
#redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db())
|
||||
redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=2)
|
||||
redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db())
|
||||
#redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=2)
|
||||
logger = fangjia.get_logger("CalcCmdReceiver")
|
||||
|
||||
|
||||
|
||||
@@ -84,7 +84,8 @@ def get_lg_mongo():
|
||||
def get_rent_redis_db():
|
||||
return 5
|
||||
|
||||
|
||||
def get_save_db():
|
||||
return 'district_stat_all_0427'
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -22,6 +22,7 @@ import time
|
||||
import fangjia
|
||||
import random
|
||||
import datetime
|
||||
import config
|
||||
|
||||
|
||||
'''
|
||||
@@ -32,12 +33,12 @@ estype='普通住宅'
|
||||
#上海闵行上海康城上海青浦南山雨果
|
||||
'''
|
||||
|
||||
client = MongoClient('192.168.10.182',27017)
|
||||
#client = MongoClient('192.168.10.182',27017)
|
||||
#dt=client.fangjia.district_stat_test
|
||||
|
||||
#dt=client.fangjia.district_stat
|
||||
dt=client.fangjia.district_stat_all_0416
|
||||
|
||||
#dt=client.fangjia.district_stat_all_0426
|
||||
dt = stat = fangjia.get_collection("fangjia", "district_stat", config.get_district_stat_host(), config.get_district_stat_port())
|
||||
def price_list(ct,rl,lk):
|
||||
|
||||
|
||||
@@ -50,9 +51,9 @@ def price_list(ct,rl,lk):
|
||||
dl = dt.find(query,fields).sort([("weekend",-1)] ).limit(10)
|
||||
#dl = dt.find(query).sort([("weekend",1)] ).limit(100)
|
||||
dl1=list(dl)
|
||||
##print(len(dl1))
|
||||
###print(len(dl1))
|
||||
df=pandas.DataFrame(dl1)
|
||||
#print('df=',df[['weekend','avg_price','calc_value']])
|
||||
##print('df=',df[['weekend','avg_price','calc_value']])
|
||||
if df.shape[0]>0:
|
||||
def add_block(df):
|
||||
|
||||
@@ -73,7 +74,7 @@ def price_list(ct,rl,lk):
|
||||
else:
|
||||
return pd.DataFrame()
|
||||
|
||||
|
||||
'''
|
||||
def plot1(x,y):
|
||||
|
||||
|
||||
@@ -90,7 +91,7 @@ def plot1(x,y):
|
||||
# 把拟合的曲线在这里画出来
|
||||
plt.legend(loc='upper left')
|
||||
plt.show()
|
||||
|
||||
'''
|
||||
|
||||
|
||||
def line_regre(x,y,num):
|
||||
@@ -100,7 +101,7 @@ def line_regre(x,y,num):
|
||||
|
||||
oe=p1(len(x))
|
||||
return oe
|
||||
##print(p1) #在屏幕上打印拟合多项式
|
||||
###print(p1) #在屏幕上打印拟合多项式
|
||||
|
||||
#上海经济建设小区崇明
|
||||
|
||||
@@ -120,32 +121,74 @@ estype='普通住宅'
|
||||
'''
|
||||
|
||||
def compare(dd1,name,credit,calc_value):
|
||||
#print('dd1=',dd1)
|
||||
y=list(dd1[name].dropna())
|
||||
#print('y=',y)
|
||||
kk=len(y)
|
||||
if kk>2:
|
||||
#kk1=kk-1
|
||||
kk1=kk
|
||||
kk1=kk-1
|
||||
y1=y[:kk1]
|
||||
x1=list(range(kk1))
|
||||
#print('y1=',y1)
|
||||
##print('y1=',y1)
|
||||
#plot1(list(range(kk)) ,y)
|
||||
|
||||
fo=line_regre(x1,y1,1)
|
||||
ratio=calc_value/fo
|
||||
|
||||
#print('fo=',fo,name)
|
||||
if credit>=0.75 and(ratio>0.8 and ratio<1.4) :
|
||||
#print('cccccc')
|
||||
return calc_value,1
|
||||
elif ratio>0.85 and ratio<1.2:
|
||||
##print('ratio',ratio)
|
||||
#print('ddddddddddddd')
|
||||
ratio=(calc_value-fo)/fo
|
||||
|
||||
#print('ratio=',ratio)
|
||||
|
||||
#print('calc_value=',calc_value)
|
||||
#print('fo=',fo)
|
||||
|
||||
|
||||
|
||||
##print('fo=',fo,name)
|
||||
#if credit>=0.75 and(ratio>0.95 and ratio<1.05):
|
||||
if abs(ratio)<=0.05:
|
||||
##print('cccccc')
|
||||
return calc_value,1
|
||||
|
||||
|
||||
#elif ratio>0.85 and ratio<1.05:
|
||||
###print('ratio',ratio)
|
||||
##print('ddddddddddddd')
|
||||
#return calc_value,1
|
||||
|
||||
|
||||
else:
|
||||
#print('eeeeeeeeeeeeee')
|
||||
return fo,0
|
||||
##print('eeeeeeeeeeeeee')
|
||||
#print('y[-1]=',y[-1])
|
||||
|
||||
def ccp(nihe,znew,ratio):
|
||||
rr0=abs((nihe-znew)/min(nihe,znew))
|
||||
#print('nihe=',nihe)
|
||||
|
||||
#print('znew=',znew)
|
||||
|
||||
#print('rr0=',rr0)
|
||||
if rr0<=0.07:
|
||||
#print('kkkkkkkkk')
|
||||
if ratio>0.05:
|
||||
return int(znew*1.05)
|
||||
else:
|
||||
return int(znew*0.95)
|
||||
else:
|
||||
|
||||
#print('pppp')
|
||||
#print(ratio)
|
||||
|
||||
if ratio>0.05:
|
||||
#print('lgggg')
|
||||
return int(nihe*1.05)
|
||||
else:
|
||||
return int(nihe*0.95)
|
||||
|
||||
|
||||
foe=ccp(fo,y[-1],ratio)
|
||||
|
||||
|
||||
return foe,0
|
||||
else:
|
||||
return calc_value,0
|
||||
|
||||
@@ -154,29 +197,29 @@ def avg_calc(dd1,credit,calc_value):
|
||||
m=compare(dd1,'calc_value',credit,calc_value)
|
||||
n=compare(dd1,'avg_price',credit,calc_value)
|
||||
|
||||
#print('m=',m)
|
||||
#print('n=',n)
|
||||
##print('m=',m)
|
||||
##print('n=',n)
|
||||
if m[1]==1 and n[1]==1:
|
||||
return m[0]
|
||||
else :
|
||||
return n[0]
|
||||
|
||||
'''
|
||||
def out_price(ct,rl,lk,calc):
|
||||
dd=price_list(ct,rl,lk)
|
||||
#print('dd',dd)
|
||||
#print('dd=',dd)
|
||||
if dd.shape[0]>0:
|
||||
|
||||
|
||||
near_id=dd['_id'].iloc[-1]
|
||||
|
||||
##print('near_id',near_id)
|
||||
###print('near_id',near_id)
|
||||
|
||||
credit=dd['credit'].iloc[-1]
|
||||
##print('credit',credit)
|
||||
###print('credit',credit)
|
||||
|
||||
#calc_value=dd['calc_value'].iloc[-1]
|
||||
calc_value=calc
|
||||
##print('calc_value',calc_value)
|
||||
###print('calc_value',calc_value)
|
||||
|
||||
if 'level' in dd.columns:
|
||||
|
||||
@@ -185,7 +228,7 @@ def out_price(ct,rl,lk,calc):
|
||||
|
||||
if dd1.shape[0]>1:
|
||||
|
||||
##print('####################')
|
||||
###print('####################')
|
||||
|
||||
return compare(dd1,'calc_value',credit,calc_value)[0],near_id
|
||||
|
||||
@@ -195,7 +238,31 @@ def out_price(ct,rl,lk,calc):
|
||||
return avg_calc(dd,credit,calc_value),near_id
|
||||
else:
|
||||
return []
|
||||
'''
|
||||
|
||||
|
||||
|
||||
def out_price(ct,rl,lk,calc):
|
||||
dd=price_list(ct,rl,lk)
|
||||
#print('dd=',dd)
|
||||
if dd.shape[0]>0:
|
||||
|
||||
|
||||
near_id=dd['_id'].iloc[-1]
|
||||
|
||||
###print('near_id',near_id)
|
||||
|
||||
credit=dd['credit'].iloc[-1]
|
||||
###print('credit',credit)
|
||||
|
||||
#calc_value=dd['calc_value'].iloc[-1]
|
||||
calc_value=calc
|
||||
###print('calc_value',calc_value)
|
||||
|
||||
return compare(dd,'avg_price',credit,calc_value)[0],near_id
|
||||
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
#pp=out_price(ct,rl,lk)
|
||||
@@ -211,11 +278,11 @@ def update(ct,rl,lk,calc):
|
||||
def update(ct,rl,lk,calc):
|
||||
dd= out_price(ct,rl,lk,calc)
|
||||
#return dd[0]
|
||||
print(dd)
|
||||
#print(dd)
|
||||
if len(dd)>0:
|
||||
data={}
|
||||
data['avg_price']=int(dd[0])
|
||||
##print(data)
|
||||
###print(data)
|
||||
|
||||
if len(dd)>0:
|
||||
dt.update_one({"_id": dd[1]},
|
||||
|
||||
@@ -48,7 +48,7 @@ def get_district():
|
||||
return seaweeds
|
||||
|
||||
|
||||
weekend = get_weekend('20180422')
|
||||
weekend = get_weekend('20180429')
|
||||
#send_cmd({"city": "西安", "region": "雁塔", "name": "鸿景花园", "weekend": get_weekend('20180325')})
|
||||
if __name__ == "__main__":
|
||||
for seaweed in get_district():
|
||||
|
||||
@@ -549,12 +549,12 @@ def commonprice(ct, rl, p):
|
||||
#return '纬度数据有误,有多个经纬度', 0
|
||||
|
||||
else:
|
||||
t1=time.time()
|
||||
#t1=time.time()
|
||||
|
||||
#####print("location['lng2'][0]",location['lng2'].iloc[0])
|
||||
|
||||
dd = neighbor(location['lng2'].iloc[0], location['lat2'].iloc[0], 5, ct, rl, p)
|
||||
print(time.time()-t1,'t1'*10)
|
||||
#print(time.time()-t1,'t1'*10)
|
||||
# print('dd=',dd,'dd'*20)
|
||||
if dd.shape[0] >= factor:
|
||||
# ####print('$'*50)
|
||||
@@ -1429,12 +1429,12 @@ def ghhh(kkg):
|
||||
return a
|
||||
|
||||
|
||||
#stat = fangjia.get_collection("fangjia", "district_stat", config.get_district_stat_host(), config.get_district_stat_port())
|
||||
#pt = fangjia.get_collection("fangjia_log", "problem_command", config.get_log_mongodb_host(), config.get_log_mongodb_port())
|
||||
stat = fangjia.get_collection("fangjia", "district_stat", config.get_district_stat_host(), config.get_district_stat_port())
|
||||
pt = fangjia.get_collection("fangjia_log", "problem_command", config.get_log_mongodb_host(), config.get_log_mongodb_port())
|
||||
|
||||
#stat = fangjia.get_collection("fangjia", "Copy_of_district_stat_shanghai_april_ten", '192.168.10.182', 27017)
|
||||
stat = fangjia.get_collection("fangjia_stat", "shanghai0419", '192.168.10.182', 27017)
|
||||
pt = fangjia.get_collection("fangjia_log", "problem_command", '192.168.10.182', 27017)
|
||||
#stat = fangjia.get_collection("fangjia", config.get_save_db(), '192.168.10.182', 27017)
|
||||
#pt = fangjia.get_collection("fangjia_log", "problem_command", '192.168.10.182', 27017)
|
||||
#################################################################
|
||||
|
||||
def region_district_list_lk(ct, rl, lk):
|
||||
@@ -1591,8 +1591,9 @@ def out_put_price(ct, rl, lk, weekend):
|
||||
p = ghhh(lf[['name', 'alias', 'estate_type2']])[0]
|
||||
|
||||
#####print('p=', p)
|
||||
|
||||
#t1=time.time()
|
||||
mm = commonprice(ct, rl, p)
|
||||
#print('mmjisuantime=',time.time()-t1,'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy')
|
||||
#####print('mm=',mm)
|
||||
c_date = datetime.datetime.utcnow()
|
||||
m_date = datetime.datetime.utcnow()
|
||||
@@ -1607,7 +1608,7 @@ def out_put_price(ct, rl, lk, weekend):
|
||||
##print('mm=',mm)
|
||||
##print(type(mm[0]))
|
||||
if type(mm[0]) != str:
|
||||
|
||||
|
||||
|
||||
# ####print(lf['estate_type2'].iloc[0],'*'*10)
|
||||
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ def get_weekend(tt):
|
||||
pacific = pytz.timezone('Asia/Shanghai')
|
||||
return pacific.localize(bb)
|
||||
|
||||
weekend = get_weekend('20180422')
|
||||
weekend = get_weekend('20180429')
|
||||
|
||||
|
||||
s = time.time()
|
||||
@@ -22,7 +22,7 @@ s = time.time()
|
||||
|
||||
ct='上海'
|
||||
rl='闵行'
|
||||
lk='虹凯小区'#杨浦凤城四村闵行上海康城厦门同安大唐世家二期青岛市北东方小区合肥庐阳海亮红玺台青岛市北东方小区
|
||||
lk='上海康城'#杨浦凤城四村闵行上海康城厦门同安大唐世家二期青岛市北东方小区合肥庐阳海亮红玺台青岛市北东方小区
|
||||
|
||||
#深圳龙岗浪背村宝安吉祥公寓门头沟 泷悦长安北京上海闵行金盛小区江苏昆山象屿珑庭###
|
||||
|
||||
|
||||
Reference in New Issue
Block a user